|
|
Check this line
oFile.Write(_T("code project\n"),sizeof(_T("code project\n")));
|
|
|
|
|
Does it have any difference from the actual code?
- NS -
|
|
|
|
|
I checked this line it works.
|
|
|
|
|
But what is the magic between
oFile.Write(_T("code project\n"),sizeof(_T("code project\n")));
and
oFile.Write("code project",sizeof("code project"));
oFile.Write("\n",1);
- NS -
|
|
|
|
|
Well can you check it and then tell me what did you see?;)
|
|
|
|
|
Use:
oFile.Write("code project", strlen("code project")); or
CStdioFile oFile;
...
oFile.WriteString("code project\n");
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
am using Hot key in one of my appliation.But there is a problem.
The Hot key combination works only when the focus is on that window . while my application is runing in the background( Its a Win32 dialog based application and i make dialog hidden at startup)and so the Hot key is not working. Is there any way I can solve this.
I am using something like this now,
LRESULT CALLBACK MyDialogProc(HWND hWndDlg,....)
{
ShowWindow(hWndDlg,SW_HIDE);
switch(message)
{
case WM_INITDIALOG:
{
InitCommonControls();
HWND hHotKey = GetDlgItem(hWndDlg,IDC_HOTKEY1);
if(!RegisterHotKey(hWndDlg , IDC_HOTKEY1, MOD_ALT | MOD_CONTROL,0x67))
{
dError = GetLastError();
MessageBox(NULL,L"Hot Key Not Working ",L"Error",0);
}
}
break;
case WM_HOTKEY:
ChangeString(hWndDlg);
break;
}
}
Thnx in advance.....
|
|
|
|
|
GauranG33 wrote: HWND hHotKey = GetDlgItem(hWndDlg,IDC_HOTKEY1);
if(!RegisterHotKey(hWndDlg , IDC_HOTKEY1, MOD_ALT | MOD_CONTROL,0x67))
From MSDN:
BOOL RegisterHotKey( HWND hWnd, int id, UINT fsModifiers, UINT vk);
id
[in] Specifies the identifier of the hot key.
but from your code, it seems the ID of a control window.
And where are you using hHotKey ?
|
|
|
|
|
Yes, IDC_HOTKEY1 is the cotrol ID of the Hotkey control which I have dragged from the ToolBox on my dialog box.
I am using Win32 Dialog Based Application. In that I have put the Hotkey Control and then I am using the previous code. The problem is that hotkey is working only when the focus is on dialog box. If the Focus is on other window.Hot Key combinations are not working.
I want to call some function when the combination of some key are pressed.And so I am using HotKey for that.
|
|
|
|
|
how to retreive the height an dwidth of an HBITMAP ?
void GetBitmapResolution( HBITMAP hBmpIn , int *BmpCx , int *BmpCy )
{
// plz tell me hwo to solve this function
}
thanks & regards
|
|
|
|
|
I almost looked this up for you, but I could not bring myself to do it. Any Windows help system will provide the answer, and several articles at CP.
Shortcut: look up my name and examine the code, I am sure the solution is in there some where.
Sorry, in a bad mood tonight.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Did you see BITMAP structure and see GetObject .
|
|
|
|
|
|
I am making an mfc dialog based application where when I click on a button should open a installation type dialogs with NEXT PREVIOUS and CANCEL BUTTON.
How to do it on mfc.
Please help me.
Dhiraj Kumar Saini
|
|
|
|
|
Have a look at PropertySheet section on this site. You will get tons of articles.
Prasad
MS MVP - VC++
|
|
|
|
|
|
I saw a code chunk like this:
// MP3FRAMEHEADER structure
struct MP3FRAMEHEADER
{
unsigned emphasis : 2; // M
unsigned original : 1; // L
unsigned copyright : 1; // K
unsigned modeext : 2; // J
unsigned chanmode : 2; // I
unsigned privbit : 1; // H
unsigned padding : 1; // G
unsigned samplerate : 2; // F
unsigned bitrate : 4; // E
unsigned hascrc : 1; // D
unsigned mpeglayer : 2; // C
unsigned mpegver : 2; // B
unsigned framesync : 11; // A
};
There,the number like 2,1,1,... means what?
It does not look like the initialized number of its front member?
Who would like to tell why the writer coding like above?
Thanks.
GOOD LUCK!
|
|
|
|
|
|
It is called as bit-fields. Have a look at link provided by Nitin.
Prasad
MS MVP - VC++
|
|
|
|
|
Oh,I see.
Thank you very much.
|
|
|
|
|
I know it now.
Thank you very much.
BEST WISHES.
|
|
|
|
|
All the values following “:” are just instructions to the compiler. They tell it to pack the variable into that number of bits. What that means, in the code you presented, is that the entire structure is stored in 32 bits, because it only requires 31 bits (it will be slower, but take up less memory).
Well that is enough for you to figure it out. Apparently the writer did not expect more than two versions of the code, because he only allowed one bit for that.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Hi,
I've been trying to figure out how to get the owner process or a window.
Basically, I want to use GetForegroundWindow() to identify the current window that has focus and then be able to, from this, get the process that owns the window. It should be possible as it's the very same thing Task Manager does.
If anyone knows how to do it, I'd be grateful.
Thanks.
|
|
|
|
|
The GetWindowThreadProcessId() API can help.
This came up recently here and I can't remember how to get the name from the process ID.
I think you need to enumerate the processes on the system and find the one that matches the ID.
A couple ways to enumerate processes:
CreateToolhelp32Snapshot()/Process32First()/Process32Next()
Use WMI and the Win32_Process class
Tydia-kun wrote: It should be possible as it's the very same thing Task Manager does.
I'm not sure why task manager would use window handles to find processes when there's many
methods available for enumerating processes and task manager also shows processes that don't
have any windows. I'd guess that task manager uses WMI.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|