Click here to Skip to main content
15,917,568 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralHow bout this Pin
shawnsch29-Sep-03 13:38
shawnsch29-Sep-03 13:38 
GeneralRe: How bout this Pin
ZoogieZork29-Sep-03 14:35
ZoogieZork29-Sep-03 14:35 
GeneralRe: How bout this Pin
shawnsch29-Sep-03 17:41
shawnsch29-Sep-03 17:41 
GeneralRe: How bout this Pin
ZoogieZork29-Sep-03 18:50
ZoogieZork29-Sep-03 18:50 
GeneralShould be easy... Pin
RobJones29-Sep-03 11:26
RobJones29-Sep-03 11:26 
GeneralRe: Should be easy... Pin
Dave Bryant29-Sep-03 11:33
Dave Bryant29-Sep-03 11:33 
GeneralRe: Should be easy... Pin
RobJones29-Sep-03 11:55
RobJones29-Sep-03 11:55 
GeneralGetModuleFileName instance and registering app Pin
Raymond So29-Sep-03 9:15
Raymond So29-Sep-03 9:15 
I'm trying to place a value in HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run so that my app starts up when windows starts up, as a background app. I've implemented DLLRegisterServer so that it is invoked when the setup.exe runs (I've set the .exe to self-register under InstallShield). In DLLSelfRegister, I need the path to the .exe so that the value in the registry is set properly and the .exe runs from that path. I use GetModuleFileName to get the path of the app, but when regsvr32 myApp.exe is run, the app is not instantiated yet.

I used MFC to create a dialog based app
Here's a code snipet:

CSysTrayDemoApp theApp; //MFC generated

...

//Implement this funciton so that regsvr32 can invoke it to register exe.
STDAPI DllRegisterServer()
{
char path[MAX_PATH];

DWORD pathLen = sizeof(fileName);

__asm int 3;

GetModuleFileName(theApp.m_hInstance, path, pathLen);
...

theApp.m_hInstance is not instantiated and thus I can't get the path name.

Does anyone have experience in registering an app/is there a better way of doing this?

Thanks,
Raymond

GeneralRe: GetModuleFileName instance and registering app Pin
Dave Bryant29-Sep-03 10:59
Dave Bryant29-Sep-03 10:59 
GeneralRe: GetModuleFileName instance and registering app Pin
igor196029-Sep-03 12:58
igor196029-Sep-03 12:58 
GeneralRe: GetModuleFileName instance and registering app Pin
Michael Dunn29-Sep-03 16:26
sitebuilderMichael Dunn29-Sep-03 16:26 
GeneralTaskbar window button Pin
blade29-Sep-03 9:01
blade29-Sep-03 9:01 
GeneralExecuting an EXE from memory Pin
Larry Antram29-Sep-03 8:54
Larry Antram29-Sep-03 8:54 
GeneralRe: Executing an EXE from memory Pin
David Crow29-Sep-03 11:14
David Crow29-Sep-03 11:14 
GeneralRe: Executing an EXE from memory Pin
Larry Antram29-Sep-03 12:23
Larry Antram29-Sep-03 12:23 
GeneralRe: Executing an EXE from memory Pin
Michael Dunn29-Sep-03 16:29
sitebuilderMichael Dunn29-Sep-03 16:29 
QuestionHow to create an "Open With" list? Pin
ralfoide29-Sep-03 8:45
ralfoide29-Sep-03 8:45 
AnswerRe: How to create an "Open With" list? Pin
Amit Dey29-Sep-03 13:33
Amit Dey29-Sep-03 13:33 
GeneralEasy question about formatting a string Pin
NewHSKid29-Sep-03 8:18
NewHSKid29-Sep-03 8:18 
GeneralRe: Easy question about formatting a string Pin
Ravi Bhavnani29-Sep-03 8:35
professionalRavi Bhavnani29-Sep-03 8:35 
GeneralRe: Easy question about formatting a string Pin
David Crow29-Sep-03 8:38
David Crow29-Sep-03 8:38 
GeneralRe: Easy question about formatting a string Pin
WREY29-Sep-03 11:49
WREY29-Sep-03 11:49 
QuestionValid Pointer ?? Pin
Shah Shehpori29-Sep-03 8:10
sussShah Shehpori29-Sep-03 8:10 
AnswerRe: Valid Pointer ?? Pin
Ravi Bhavnani29-Sep-03 8:39
professionalRavi Bhavnani29-Sep-03 8:39 
AnswerRe: Valid Pointer ?? Pin
David Crow29-Sep-03 8:53
David Crow29-Sep-03 8:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.