|
Oh, that's what it was. Thnx
Works now
|
|
|
|
|
in the SetWindowsHookEx function, I set the _pModule->get_m_hInst() as the HINSTANCE parameter.
The relust of this code is a local hook on the procedure.
"Global hook procedures should be placed in a separate DLL". is com is a separate DLL
<br />
hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, <br />
LowLevelKeyboardProc, <br />
_pModule->get_m_hInst(), <br />
0);<br />
a related article is talking about the subject in a standart DLL (not COM).
http://www.codeproject.com/win32/AntonioWinLock.asp
|
|
|
|
|
Hello!
I need to execute the HtmlHelp application with some file and page as parameter. I wanted to use the CreateProcess function for this, but unfortunately cannot get it work.
This works perfectly:
WinExec("hh.exe MyHelpFile.chm::features.html", SW_SHOW);
But this doesn't work:
STARTUPINFO sui;
PROCESS_INFORMATION pi;
ZeroMemory(&sui, sizeof(STARTUPINFO); sui.cb = sizeof(STARTUPINFO);
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION);
CreateProcess("hh.exe", "MyHelpFile.chm::features.html", NULL, NULL, FALSE, 0, NULL, NULL, &sui, &pi); Anyone knows why the WinExec works, but the CreateProcess doesn't??
Thanks and best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
This looks good to me. From memory WinExec() is a wrapper around CreateProcess(). What does GetLastError() return?
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
It returns 2: file could not be found...
Any idea?
Best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
|
Hm.. Ok, now the hh.exe starts at least... Hh.exe is in my Windows directory, will it always be there? (under WinNT in WinNT directory?) Even if using the GetWindowsDirectory function, it's a dangerous assumption...
But now I get an error from the hh.exe: no command line was specified?!??!
Any more ideas?
Thanks and best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
I don't think you are supposed to do it this way. See this MSDN link[^] for details of the HtmlHelp API call. The added benfit of this is that when the application that displayed the help closes, the help file itself also closes automatically.
|
|
|
|
|
Graham Bradshaw wrote:
The added benfit of this is that when the application that displayed the help closes, the help file itself also closes automatically.
Benefit?! Personally, I hate this "feature"
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I know that crappy HtmlHelp API function. I will definitively not use this; if the WinExec call wouldn't work the users would have bad luck and no help Fortunately the WinExec method works... I was just wondering why the CreateProcess doesn't work...
Best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Dominik Reichl wrote:
Hm.. Ok, now the hh.exe starts at least... Hh.exe is in my Windows directory, will it always be there? (under WinNT in WinNT directory?) Even if using the GetWindowsDirectory function, it's a dangerous assumption...
Agreed. You need to follow the same rules as WinExec.
The directory from which the application loaded.
The current directory.
The Windows system directory. TheGetSystemDirectory function retrieves the path of this directory.
The Windows directory. TheGetWindowsDirectory function retrieves the path of this directory.
The directories listed in the PATH environment variable.
Dominik Reichl wrote:
But now I get an error from the hh.exe: no command line was specified?!??!
Does it work if you specify just the filename?
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
Neville Franks wrote:
Does it work if you specify just the filename?
No, it doesn't. Exactly the same message appears.
Thanks and best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Neville Franks wrote:
From memory WinExec() is a wrapper around CreateProcess().
I read this same thing, too.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Because, when you pass the command line, you usually have to include the full file path to the EXE as the first argument on the command line. Traditionally, argv[0] is the path to the program and ANY arguments after that are of interest, so, try this instead...
STARTUPINFO sui;PROCESS_INFORMATION pi;ZeroMemory(&sui, sizeof(STARTUPINFO); sui.cb = sizeof(STARTUPINFO);ZeroMemory(&pi, sizeof(PROCESS_INFORMATION);CreateProcess("hh.exe", "hh.exe MyHelpFile.chm::features.html", NULL, NULL, FALSE, 0, NULL, NULL, &sui, &pi);
Note that I ONLY typed in hh.exe at beginning of command line, you might actually need the FULL file path..
STARTUPINFO sui;
PROCESS_INFORMATION pi;
ZeroMemory(&sui, sizeof(STARTUPINFO);
sui.cb = sizeof(STARTUPINFO);
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION);
CreateProcess("hh.exe", "<full path="" to="" hh.exe="" here=""> <full path="" to="" help="" file="" here="">::features.html", NULL, NULL, FALSE, 0, NULL, NULL, &sui, &pi);
See if that works...
|
|
|
|
|
It works perfectly when I prepend the command-line a "hh.exe " and pass the full path to the executable as first parameter for CreateProcess.
Many thanks!!
Best regards,
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Hello,
how do I get notified if the user is pressing the minimize button in dialog based app, so I can perform certain operation?
Thanks in advance,
D.
|
|
|
|
|
Implement your own OnSysCommand handler:
void CMyDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if(nID == SC_MINIMIZE)
{
}
CDialog::OnSysCommand(nID, lParam);
}
Hope that helps, best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Thanks
|
|
|
|
|
I am working on a graphics application where I draw an ellipse and I need to incorporate a little delay, then erase this ellipse and redraw it elsewhere. I was able to do it very easily in Turbo C using the delay() function. How do I implement this in VC++ 6.0?
log live the dEvIL
|
|
|
|
|
you shuold use the Sleep() function.
it takes 1 parameter(DWORD) which is the time to sleep,in miliseconds.
Regards,
Eli
|
|
|
|
|
I have set a dialog box on the toolbar. There is a Editbox with a Button on the dialog box. The Editbox supposed to get a value from the user and once the Button is pressed, the value will be transfered into a variable in CView. I added a CDialogBar variable m_pointDistro but since there is no class for the dialogbox, I dont know how to add this variable.
Editbox ID is IDC_NPOINTS. I selected new class of the Dialogbox as CView but I was forbided to do that. So the Dialogbox ended up as no class. I chose the Button and added a function called OnDistro().
void CProgramView::Distro() {
CMainFrame* pMainFrame = (CMainFrame*)GetParentFrame();
CEdit* pArray = (CEdit*)(pMainFrame->m_pointDistro.GetDlgItem(IDC_NPOINTS));
.
.
}
1) If I accidentally made the dialogbar has no class, how can i revert back?
2) The coding I used to get value from the dialogbox couldnt work. How can I fix it?
Thanks,
|
|
|
|
|
i want to generate some random numbers,
but with in a limit ( i.e i want to generate the random numbers with in 50) how can i do it by using the rand() ?
Thanks in advance
Ninety-eight percent of the thrill comes from knowing that the thing you designed works, and works almost the way you expected it would. If that happens, part of you is in that machine.
|
|
|
|
|
Try
srand( (unsigned)time( NULL ) );
for( int i = 0; i < 20; i++ )
{
int n = int (50 * ( (double) rand() / RAND_MAX ));
cout << n << "\n";
}
Typical output:
4
48
10
16
27
12
10
27
45
39
24
15
7
3
12
22
24
25
19
28
Kevin
|
|
|
|
|
Kevin McFarlane wrote:
int n = int (50 * ( (double) rand() / RAND_MAX ));
Aaaah, finally someone else who knows the best way to use rand() . Most people just use the % operator, but statistically, using your approach leads to more randomness, as the rand() algorithm has the property that the higher-order bits are more random than the lower order bits.
Or did you just guess?
Either way, well done
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I just guessed. In fact I'd thought that eli15021979's % method was slicker! But you learn something new every day.
Kevin
|
|
|
|
|