Shortcut working directory

Hello,
I have an MDI application which supports doeble clicking on an NFG file to 
open the file.
However, it works only for NFG files that located on the same directory with 
the ConfigNet.exe file name.
For NFG that are located in different folders, the application cannot run, 
becuase it cannot find some dllz required for the application to run.

I set the application path in the regisrtry, so if I put the exe file in any 
folder and double click it it works. I want the same beahviour for opening 
an NFG file (by double clicking it).
Thanks,
Janiv Ratson.


0
Janiv
1/31/2006 9:47:19 AM
vc.mfc 33608 articles. 0 followers. Follow

5 Replies
484 Views

Similar Articles

[PageSpeed] 31

> Hello,
> I have an MDI application which supports doeble clicking on an NFG file to 
> open the file.
> However, it works only for NFG files that located on the same directory with 
> the ConfigNet.exe file name.
> For NFG that are located in different folders, the application cannot run, 
> becuase it cannot find some dllz required for the application to run.
> 
> I set the application path in the regisrtry, so if I put the exe file in any 
> folder and double click it it works. I want the same beahviour for opening 
> an NFG file (by double clicking it).
> Thanks,
> Janiv Ratson.
> 
> 

Try something like this:

	TCHAR ModuleFileName[MAX_PATH+1];
	GetModuleFileName(NULL, ModuleFileName, MAX_PATH);
	CString dll_location = ModuleFileName;
	dll_location = dll_location.Left(dll_location.ReverseFind(_T('\\'))+1);
	dll_location += _T("MY.DLL");

	HMODULE hModule = ::LoadLibrary(dll_location);
0
js6519 (32)
1/31/2006 6:34:08 PM
I'm not sure what an NFG files is exactly, but you should look at:

RegisterShellFileTypes(true);

As this will register your document type with explorer for your application. 
The user will have to have permission to change the registry for 
HKEY_CLASSES_ROOT (which means not a totally Limited User).

Tom

"Janiv Ratson" <janivr@gmailcom> wrote in message 
news:e04XerkJGHA.1424@TK2MSFTNGP12.phx.gbl...
> Hello,
> I have an MDI application which supports doeble clicking on an NFG file to 
> open the file.
> However, it works only for NFG files that located on the same directory 
> with the ConfigNet.exe file name.
> For NFG that are located in different folders, the application cannot run, 
> becuase it cannot find some dllz required for the application to run.
>
> I set the application path in the regisrtry, so if I put the exe file in 
> any folder and double click it it works. I want the same beahviour for 
> opening an NFG file (by double clicking it).
> Thanks,
> Janiv Ratson.
>
> 


0
tserface (3861)
1/31/2006 8:38:15 PM
I cannot use LoadLibrary, becuase I'm using many 3rd party dllz.
I don't want my application to be dependent on others dlls.
Also there are too many dllz to use LoadLibrary for (about 30 dllz !!!).
Please help,
If there is any solution ....

I'll try to explain my problem again:

When I double Click on an NFG file (which is a doc template in my app, and 
yes, I'm using RegisterShellFileTypes(true); - that is the reason it works 
when you double click an NFG file that is located in the location with my 
EXE file).
Some dll cannot be located.

If I double click on a shortcut to my applicaiton located on the Desktop it 
works.
If I double click on a shortcut to an NFG file that is located in my EXE 
fiile directory, it works.
If I double click on a shortcut to an NFG file that is located somewhere 
else, it displays a message about it cannot find a dll.

Thanks again,
Janiv Ratson.



"jSmith" <js@aol.com> wrote in message 
news:OvioWUpJGHA.3224@TK2MSFTNGP09.phx.gbl...
>> Hello,
>> I have an MDI application which supports doeble clicking on an NFG file 
>> to open the file.
>> However, it works only for NFG files that located on the same directory 
>> with the ConfigNet.exe file name.
>> For NFG that are located in different folders, the application cannot 
>> run, becuase it cannot find some dllz required for the application to 
>> run.
>>
>> I set the application path in the regisrtry, so if I put the exe file in 
>> any folder and double click it it works. I want the same beahviour for 
>> opening an NFG file (by double clicking it).
>> Thanks,
>> Janiv Ratson.
>>
>>
>
> Try something like this:
>
> TCHAR ModuleFileName[MAX_PATH+1];
> GetModuleFileName(NULL, ModuleFileName, MAX_PATH);
> CString dll_location = ModuleFileName;
> dll_location = dll_location.Left(dll_location.ReverseFind(_T('\\'))+1);
> dll_location += _T("MY.DLL");
>
> HMODULE hModule = ::LoadLibrary(dll_location); 


0
Janiv
2/12/2006 3:10:27 PM
can you try to add the path for these dll's to the PATH environment 
variable?



Thank you.



"Janiv Ratson" <janivr@gmailcom> wrote in message 
news:Ow1U$X%23LGHA.1124@TK2MSFTNGP10.phx.gbl...
>I cannot use LoadLibrary, becuase I'm using many 3rd party dllz.
> I don't want my application to be dependent on others dlls.
> Also there are too many dllz to use LoadLibrary for (about 30 dllz !!!).
> Please help,
> If there is any solution ....
>
> I'll try to explain my problem again:
>
> When I double Click on an NFG file (which is a doc template in my app, and 
> yes, I'm using RegisterShellFileTypes(true); - that is the reason it works 
> when you double click an NFG file that is located in the location with my 
> EXE file).
> Some dll cannot be located.
>
> If I double click on a shortcut to my applicaiton located on the Desktop 
> it works.
> If I double click on a shortcut to an NFG file that is located in my EXE 
> fiile directory, it works.
> If I double click on a shortcut to an NFG file that is located somewhere 
> else, it displays a message about it cannot find a dll.
>
> Thanks again,
> Janiv Ratson.
>
>
>
> "jSmith" <js@aol.com> wrote in message 
> news:OvioWUpJGHA.3224@TK2MSFTNGP09.phx.gbl...
>>> Hello,
>>> I have an MDI application which supports doeble clicking on an NFG file 
>>> to open the file.
>>> However, it works only for NFG files that located on the same directory 
>>> with the ConfigNet.exe file name.
>>> For NFG that are located in different folders, the application cannot 
>>> run, becuase it cannot find some dllz required for the application to 
>>> run.
>>>
>>> I set the application path in the regisrtry, so if I put the exe file in 
>>> any folder and double click it it works. I want the same beahviour for 
>>> opening an NFG file (by double clicking it).
>>> Thanks,
>>> Janiv Ratson.
>>>
>>>
>>
>> Try something like this:
>>
>> TCHAR ModuleFileName[MAX_PATH+1];
>> GetModuleFileName(NULL, ModuleFileName, MAX_PATH);
>> CString dll_location = ModuleFileName;
>> dll_location = dll_location.Left(dll_location.ReverseFind(_T('\\'))+1);
>> dll_location += _T("MY.DLL");
>>
>> HMODULE hModule = ::LoadLibrary(dll_location);
>
> 


0
mshalabi (1)
3/8/2006 12:36:10 AM
One reasonable way to help your program find load-time DLLs would be to 
create a trampoline which sets the current directory, then launches your 
true process passing along the command-line.

"Mohammad Shalabi" <mshalabi@microsoft.com> wrote in message 
news:OSYoNhkQGHA.2416@tk2msftngp13.phx.gbl...
> can you try to add the path for these dll's to the PATH environment 
> variable?
>
>
>
> Thank you.
>
>
>
> "Janiv Ratson" <janivr@gmailcom> wrote in message 
> news:Ow1U$X%23LGHA.1124@TK2MSFTNGP10.phx.gbl...
>>I cannot use LoadLibrary, becuase I'm using many 3rd party dllz.
>> I don't want my application to be dependent on others dlls.
>> Also there are too many dllz to use LoadLibrary for (about 30 dllz !!!).
>> Please help,
>> If there is any solution ....
>>
>> I'll try to explain my problem again:
>>
>> When I double Click on an NFG file (which is a doc template in my app, 
>> and yes, I'm using RegisterShellFileTypes(true); - that is the reason it 
>> works when you double click an NFG file that is located in the location 
>> with my EXE file).
>> Some dll cannot be located.
>>
>> If I double click on a shortcut to my applicaiton located on the Desktop 
>> it works.
>> If I double click on a shortcut to an NFG file that is located in my EXE 
>> fiile directory, it works.
>> If I double click on a shortcut to an NFG file that is located somewhere 
>> else, it displays a message about it cannot find a dll.
>>
>> Thanks again,
>> Janiv Ratson.
>>
>>
>>
>> "jSmith" <js@aol.com> wrote in message 
>> news:OvioWUpJGHA.3224@TK2MSFTNGP09.phx.gbl...
>>>> Hello,
>>>> I have an MDI application which supports doeble clicking on an NFG file 
>>>> to open the file.
>>>> However, it works only for NFG files that located on the same directory 
>>>> with the ConfigNet.exe file name.
>>>> For NFG that are located in different folders, the application cannot 
>>>> run, becuase it cannot find some dllz required for the application to 
>>>> run.
>>>>
>>>> I set the application path in the regisrtry, so if I put the exe file 
>>>> in any folder and double click it it works. I want the same beahviour 
>>>> for opening an NFG file (by double clicking it).
>>>> Thanks,
>>>> Janiv Ratson.
>>>>
>>>>
>>>
>>> Try something like this:
>>>
>>> TCHAR ModuleFileName[MAX_PATH+1];
>>> GetModuleFileName(NULL, ModuleFileName, MAX_PATH);
>>> CString dll_location = ModuleFileName;
>>> dll_location = dll_location.Left(dll_location.ReverseFind(_T('\\'))+1);
>>> dll_location += _T("MY.DLL");
>>>
>>> HMODULE hModule = ::LoadLibrary(dll_location);
>>
>>
>
> 


0
bvoigt (5)
3/15/2006 11:01:16 PM
Reply:

Similar Artilces:

How do I get IIf(IsNull.... to work??
I am trying to write a record source of the Customer field on my Orders table as: IIf(IsNull([FirstName]),IIf(IsNull([LastName]),[Street] & ", " & [Suburb],[FirstName]& " " [LastName])) but I'm getting an error - invalid syntax (amongst others!) I can get the following to work: SELECT Customers.CustomerId, IIf(IsNull([FirstName]),IIf(IsNull([LastName]),[Street] & ", " & [Suburb])) AS CustomerName FROM Customers; Basically the CustomersTable has a FirstName, LastName, Street and Suburb field. Some customers only have a...

Exchange directory Migration using ADMT
Hi, While migrating Exchange Directory migration using ADMT tool the following error occurs. WRN1:7578 Unable to establish SSL connection with the exchange server 'Servername' at port 636. rc=58. The specified server cannot perform the requested operation. I have added the keys in the registry of the target domain(Exchange LDAP/SSL Port keys).Even then the problen persists. Can anyone help me. Regards, Shankar. Hi, Please can anyone let me know asap. I am unable to solve this. "shankar" <shrankar@yahoo.co.in> wrote in message news:eL3$m#jPEHA.3988@tk2msftngp13...

Shortcut Ctrl-X not working on multiple cells
In Excel 97, on some spreadsheets I can't use Ctrl-X to cut multiple cells at once. Other ways to cut work, but Ctrl-X is my preferred method. On other spreadsheets this does work. Has anyone ever seen this before? What happens when you try? Nothing? Error message? Cuts wrong area? Gord Dibben MS Excel MVP On 21 Sep 2006 09:57:16 -0700, "CDM" <mctigrit@yahoo.com> wrote: >In Excel 97, on some spreadsheets I can't use Ctrl-X to cut multiple >cells at once. Other ways to cut work, but Ctrl-X is my preferred >method. On other spreadsheets this does w...

Wireless mouse stops working properly in Outlook 2003
Whenever I launch Outlook 2003 and it connects to my Pop mail account over a wireless internet connection, my wireless mouse starts behaving erratically and can't be used from within Outlook. it will still work in other programs but not in Outlook. And it works fine in Internet explorer when surfing using the wireless connection. So why does Outlook 2003 stop my mouse working properly? What type of mouse is it? Logitech? There have been problems with that = particular mouse for a long time. See if they have updated drivers for = your mouse. --=20 Milly Staples [MVP - Outlook] Post a...

Will a merge work
I would like to have a single generic letter but inside this letter I need to put a list of infractions. There are only 18 infractions that can go in this letter. But you will not use all the infractions the same but need to chose one or more of these infractions and put then in the same place in the letter. Would I create the infractions in excel and do a merge? Will the merge then give you the list where you can check only the infractions that you want? Or should I be doing something different. Thanks you would create an excel template of the letter. then create a...

Transposing column to row doesn't work
Yes, I know the official way to do this..but it's not working. I select a column in worksheet 1. I click cell A1 in worksheet 2. I select Edit>Paste Special, click the Transpose checkbox, and select OK. I receive this message: "The information cannot be pasted because the Copy area and the paste area [dontcha just love the inconsistency in capitalization?] are not the same size and shape. [of course not--i'm transposing!!] Try one of the following: "* Click a single cell, and then paste. [which is what I did that didn't work] "* Select a rectangle that's t...

Formatting a range of cells doesn't work
Hi All, I have a workbook exported by Access. Selecting a unique cell or a range of cells the cell formatting doesn't work neither chosen from the menu nor right-clicking on the cell (the formatting dialog-box doesn't come up at all). Selecting an entire column or row cell formatting works normally. What is the cause of this and how to fix the problem? Regards, Stefi Not heard of this before, but if it's a single sheet you could Insert, Worksheet, copy the old worksheet, select cell A1 on the new worksheet and Paste Special, Values (assuming there was no intended formatting ...

work offline #2
When I start MS Money 2005 Delux, it tries to log on to the internet. I turned off everything I can see and it still does it. When I stop the dialer, "work offline" is checked under FILES but the next time I start it, it does it again. I don't want money to log me on every time I bring it up. MS Money 2003 didn't do this.....thanks in advance Rich Sorry but none of us that post have found a way. It seems that M2005 demands to go on-line - even if you have no on-line accounts - to get latest currency rates and share prices. -- Regards Bob Peel, Microsoft MVP - ...

Attaching notes to fixed assets doesn't work
If you attach a note to a fixed asset ID, it appears on all fixed assets instead of just being attached to one. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowser/en-us/default.mspx?mid=324bfeee-0d6...

Publisher Web Site Causes Explorer to Crash, Firefox works OK
I used Excel to graph some measurement data. I then copied and pasted to Publisher 2003. Added some text boxes. Used preview and all was well. FTP'd to my site and all was well. Until I tried IE v6.0. The index.htm page has three graphs. IE would only display the second, then crash and shutdown. Firefox works fine. I've tried this from several computers with the same results. I've worked on this for eight hours and gotten no where. I notice that there are tons of files that I didn't expect that get generated by Publisher when converting to HTML. Is there an...

Any File\Send To\Mail Reciepient feature doesn't work
I have WinXP w/Outlook 2003. When I right click a file and choose Send To\Mail Recipient, the feature does not work. I have got it to work one time by going to Control Panels\Add Remove Programs\Set Program Access and Defaults. There I select Microsoft Windows, (instead of Custom), restart the computer and I can then send to mail recipient, but only one time. After that I get the Error message, Microsoft Office Outlook, The operation failed. This feature works when I select Outlook Express as my default Email client in Internet options. Please can someone help! Thanks in advance. Gregg "...

PreTranslateMessage wont work for CListBox in dynamically loaded DLL
Hi there. I have a DLL where I have a CDialog derived window where is CListBox derived class. On that class I override PreTranslateMessage. Ok. I load this library dynamicallyby in my application by calling LoadLibrary. And this damn PreTranslateMessage is not called at all! First I set a breakpoint there. But then tried to put a MessageBox inside this method since I was thinking that my debugger probably could be broken. Ok. The same CListBox derived class I use in the main application also and there PreTranslateMessage is working fine. Is there some known problems with deriving this ...

Control tip text not working
Hi! I,m trying to use Controltip text in my forms but for some reason its nor working. Is ther any control or setting that i have to adjust to get the Controltip text functoin to work in access 2007? I,ve also tried to open a new access database to test this but its not working. Could it be something wrong with access or am i missing some reference or what could be wrong. Best regards Arne Olsson I just tested one of my old MDBs on Access 2007 and the ControlTip text worked fine. I also tested in the Northwind database using the ACCDB filetype, and it worked fine. Try selecti...

paste command not work in 'comment'
how do i paste copied values in a comment If you want to copy a range of values into a comment, here's a start. Select the range of values first, then run the macro. It'll prompt you for a cell location to which you'll create a comment containing the values. Sub CopyIntoComment() Dim cell As Range Dim strAllCells As String Dim strComLocation As String If Intersect(ActiveSheet.UsedRange, Selection) Is Nothing Then MsgBox "Nothing selected." Exit Sub End If strComLocation = InputBox("Enter cell where comment will go:") If strComLocation = ""...

shortcut menu
I wanted to create shortcut menu for user to right click instead of click a button. I just noticed that the shortcut menu need to call a public function in the module and the public function must call a public procesdure in the form. My click event is private. The shortcut menu must call public function in the module and call public procedure on the form and my public procedure call the event. It seems the shortcut menu needs call 3 level down. Are there any easier way to do this? Your information is great appreciated, "Souris" <Souris@discussions.microsoft.com> wro...

Mouse vs. Keyboard Shortcut Keys
Hi, We have Windows XP and use Microsoft Office 2003. We will be upgrading to Office 2007 the end of this year. There is an ongoing debate in my department (word processing operators) between those who like to use the mouse, and those who prefer keyboard shorcuts. Those who prefer keyboard shortcuts say it's faster than the mouse because you don't have to take your hands off the keyboard. (Those who use the mouse do also use some keyboard shortcuts; by contrast those who prefer keyboard shortcuts tend to not use the mouse at all.) The research I have done does i...

Hyperlink does not work with #
I have Outlook 2002, When I add a file as hyperlink that have the character '#', the hyperlink does not work, i.e.: <file://R:\Prod_Supt_Workbook\Production\Inwork\09_Inciden t_Data\2001-Plogs\2001-Plogs\Pl#0959 \SpecSit_PAYGDGCO_for_Cleanup_of_prod_Libraries.doc> If I change the "#" for its hexadecimal value "%23" the hyperlink works fine: <file://R:\Prod_Supt_Workbook\Production\Inwork\09_Inciden t_Data\2001-Plogs\2001-Plogs\Pl#0959 \SpecSit_PAYGDGCO_for_Cleanup_of_prod_Libraries.doc> Do you know if there is a patch for this? Thanks There is no pa...

Vlookup or Hlookup does not work
Hi, I need a simple formula... seems very diffucult to get In Sheet 1 I have employee names on horizontal line and a lot of numbers in vertical line. In Sheet2, i Have emloyee names on vertical line and in horisontal line i want to set up formula in sheet2 so that it calcualtes total number for each month for each name as per below sample: Sheet1 John Month days January 5 january 3 january 4 February 10 March 6 TOtal 28 Sheet 2 JOhn January February March 12 10 6 or at least John and 28 days total. Take a look SUMIF ...

How do I open a floppy from a Works file in Excel on new computer
I have a floppy disk with a Works file on it. How can I open it on my new computer and transfer the data to an Excel file? You need top convert it to excel file format first, excel cannot read works spreadsheet files If you still have works you can save as *.xlr http://www.rl-software.com/converter/wks-wdb-to-excel.htm the above link shows a conversion program -- Regards, Peo Sjoblom Excel 95 - Excel 2007 Northwest Excel Solutions www.nwexcelsolutions.com "It is a good thing to follow the first law of holes; if you are in one stop digging." Lord Healey "Barbie&quo...

My Excel Sheet that worked fine for months opens small without controls to enlarge
Hi Gang, My copy of Excel may have a virus or something. However, AVG Anti-Virus says the document I'm having problems with is A-Okay. Basically if I work with a new sheet I can minimize, maximize, and restore the child window like one would expect. However once I open my EPS timesheet, which I've been using without issues for months now opens at a size to small to manipulate and in a window lacking border controls to resize. Please see the screenshot to see what I'm talking about. Does anyone know if there's a properties dialog or a repair feature that can fix this docume...

Excel is working slowly when I have several tabs with 20,000+ rows---- any way to speed it up?
Hello - I am having a consistent problem when I build a series of spreadsheets that contain many rows (usually about 20-50,000 rows in several spreadsheets), and contain several "if formulas", and contain several Vlookup formulas. I get a "calculating cells" message for basically every little thing I do--making my work very, very slow. Just to simply add a column, it will take as long as a minute. I have excel 2003. Any recommendations on how I can avoid this problem, or make things go faster? Thanks. Mike You could switch off auto recalc (Tools>Options...>Calcu...

Right Click "Save Target As" Doesn't Work In Outlook
When I try to download a file that's part of the body of text in my email... it doesn't allow me to do anything. When I right Click over the link "Save Target As" never appears. All I see is "Select" "View Source" "Edit Message". Any suggestions on changes I can make to correct this? Thanks Jay ...

Can you help make this work?
I needa job, thought this formula would help. It compiles but, like me, it ain't working! ======================================= Sub Stantial() Hell = CrappyJob End Sub Function CrappyJob(Optional OvertimeHours = 0) LowPay = ResultOf(PoorEducation And CrappyJob) If LowPay <> Unhappiness Then LowPay = LessFreedom + FewerToys While ItSucks(CrappyJob And LowPay) Fullfillment = Want / More / Toys If Not Fullfillment Then ComeToRealization = Toys <> Happiness If ComeToRealization Then LowPay = Increase(Low...

OL 2010 Pro Plus: Email stops working (3 POP3 accounts) but all still work with iPhone
I have three email accounts, all POP3 (none with Exchange). All stopped working today after working fine last night. There have been no system configuration changes since last night, including my firewall. When none of my 3 accounts would send/receive, I ran scanpst multiple times, but email never started to work. (If it matters, I found errors in the PST file after the first scan.) Then I deleted the three email accounts in Outlook and reentered. One of the accounts then would send/receive, but not the two others, nor could they perform the two tests in the account setup when I clicked ...

Webmail not working
Hi We have recently upgraded one of our exchange 5.5 sites to 2003 by adding a new server and removing the old 5.5 server. Everything works on this server apart from webmail. We have a central front end webmail server that we use to access all of our 2003 servers and this is working for all the exchanges servers apart from this new one. When you try to access the page you enter your username and password and the page goes blank and after about 60 secs or so it comes back with page cannot be displayed. If I try to directly connect to webmail on the server after entering my password I g...