Hi
I guess I found the solution:
1) I used the function get_coursemodule_from_instance ($modulename, $instance, $courseid=0) from datalib.php (moodle ver 1.6.x).
2) $cmr = get_coursemodule_from_instance('resource', $modallresource->resource, $resource->course);
3) Finally:
foreach ($mymodules as $mymodule) {
$link = "<a href="../resource/view.php?id= $cmr->id ">$resource_name</a>";
}
I think now it works fine in the Moodle 1.4, 1.5 and 1.6...
One more little step in my first simple module