|
jinzhecheng wrote: my question is: if Thread B is processing msg2, and Thread A are going to
send msg1 , Thread A will wait until Thread B finishes processing msg2??
Offcourse... Thread B should finish previous Message Processing before taking new task...
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Sir
Can any help me in knowing which message is fired
when Windows is
1)about to Shutdown?
2)when we press F1;
3)when we click on Shutdown among 3 options
ie; restart,shutdown,standby.
i am waiting 4 u reply , i have this doubt form many days thank u for helping me in order to understand vc++ msgs.
bye
Satishvarma.E
|
|
|
|
|
Intercepting the Ctrl+Alt+Del sequence is not a trivial task. To do it effectively requires a good knowledge of GINA.
When Windows is being shut down or restarted, it will send a WM_QUERYENDSESSION to each top-level window. Handle that message accordingly.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: When Windows is being shut down or restarted, it will send a WM_QUERYENDSESSION to each top-level window.
I see this answer quite often when it comes to questions about system shutdown/logoff so I want to clarify something. I have always been under the impression that the message to handle for system shutdown is WM_ENDSESSION not WM_QUERYENDSESSION . Query just asks the running apps if it is ok to shut down the system at this time, it makes no guarantees that the system is actually shutting down. If you close your app when it recieves the query it may end up being closed when the system is not shut down, leaving the user confused as to why the app closes on it's own for some unknown reason. Or am I misreading what it says in MSDN?
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote: Or am I misreading what it says in MSDN?
Your comprehension is fine. Most folks ask the question in a general sense. In this case, I usually direct them to WM_QUERYENDSESSION where they can then (hopefully) find WM_ENDSESSION , too.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I am trying to specify the paper tray / bin from which to print a document. I am using the DEVMODE structure and a call to CreateDC(). My other DEVMODE attributes work perfect, but no matter what I do, I cannot get the document to print from a different tray.
Code snippet here:
...
devMode.dmDefaultSource = this->tray; /* number between 1 and 15 */
devMode.dmFields = devMode.dmFields | DM_DEFAULTSOURCE;
return CreateDC(NULL, inPrinter, NULL, &devMode);
}
This has been driving me crazy for too long.
Any help is appreciated.
Craig
|
|
|
|
|
rcraigadams wrote:
devMode.dmDefaultSource = this->tray; /* number between 1 and 15 */
From where you getting this->tray... have you make a call to DeviceCapabilities ( which reterive capabilities of printer device)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi All,
I'm really baffled and having struggled for several days, I need to bare my soul and ask for help
With C++ VS 6, I have created a COM component, added an ATL (Full Control), added methods and events to the appropriate interfaces and then created a modeless dialog (CDialog) in the component. The control has no CWnd so when I create the modeless dialog, I use Create (IDD,NULL) where the NULL indicates, I think, that the parent is the main app window, of which there is none, at least not in the COM component itself.
Things all work well so far and I have added a bunch of standard dialog controls, buttons, statics, edit controls, etc all working fine EXCEPT I am unable to use the TAB key to move between edit controls. In general, it seems that mouse messages are sent to the dialog where I can handle them but most keyboard messages (WM_CHAR, WM_KEYDOWN, WM_KEYUP, etc. are not. In fact, I even added a PreTranslateMessage handler to the dialog, but it never even gets called?
In desperation, I added a PreTranslateMessage handler to the "MFC host app" that instantiates and uses the COM component and indeed I can capture the messages of interest from the CDialog in the COM component, WM_CHAR, WM_KEYDOWN, WM_KEYUP, etc but of course it doesn't do me much good to have the messages at this high level. My guess is that the messages get to the MFC host app because, to a COM component, the host app "is" the main application window??
Either way, I really need to have the dialog in the COM component allow the user to tab between edit controls. Any help would be greatly appreciated.
Thanks,
Doug
Doug Knudson
|
|
|
|
|
Sir i want to insert more than one checkbox for
mutiple selection in menu.I have tried ON_UPDATE_COMMAND_UI,we could perform only one selection
form many menu item, Sir could u please help
me to how to insert any controls(CheckBox,radio,spin)as
menu items.
Satish varma.E
|
|
|
|
|
I don't think I have seen such stuff before.
You could create a modeless child dialog with custom controls and so on, and show it when the menu header is clicked, and at the right place, and handle the problem of the whole dialog losing focus, and hiding it yourself. It would look cool with all the controls, but it is a difficult lengthy task.
this is this.
|
|
|
|
|
Hi all:
I tried to sort out creating a bmp file and save an image in C++. It really annoyed me. Following is my test code, but it doesn't work. Could somebody give me an idea how to create a bmp file and store an image please????
Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
void draw(){
int x[100];
int n = 0;
for(int i = 0; i < 10; i ++){
for (int j = 0; j < 10; j ++){
x[i*10+j] = n++;
if (n >= 255) n = 0;
}
}
HBITMAP map = CreateBitmap(10, 10, 1, 8, x);
if (map == NULL) cout << "cao ni ma\n";
HANDLE hf; // file handle
BITMAPFILEHEADER hdr; // bitmap file-header
BITMAPINFOHEADER bih; // bitmap info-header
LPCTSTR filename = "output.bmp";
DWORD dwTmp;
hdr.bfSize = sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+sizeof(x);
hdr.bfReserved1 = 0;
hdr.bfReserved2 = 0;
hdr.bfType = 0x4d42;
hdr.bfOffBits = sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER);
bih.biSize = sizeof(BITMAPINFOHEADER);
bih.biWidth = 100;
bih.biHeight = 100;
bih.biPlanes = 1;
bih.biBitCount = 8;
bih.biCompression = BI_RGB;
bih.biSizeImage = 0;
bih.biXPelsPerMeter = 0;
bih.biYPelsPerMeter = 0;
bih.biClrUsed = 0;
bih.biClrImportant = 0;
hf = CreateFile(filename,
GENERIC_READ | GENERIC_WRITE,
(DWORD) 0,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
(HANDLE) NULL);
WriteFile(hf, &hdr, sizeof(BITMAPFILEHEADER),(LPDWORD) &dwTmp, NULL);
WriteFile(hf, &bih, sizeof(BITMAPINFOHEADER), (LPDWORD) &dwTmp, NULL);
WriteFile(hf, (LPSTR) x, 100, (LPDWORD) &dwTmp, NULL);
}
Asura
|
|
|
|
|
Hello Luo ming,
Take a look at "programing windows", there is intensive discussion about bitmap
stuff.
Good luck!
|
|
|
|
|
Ming Luo wrote: WriteFile(hf, (LPSTR) x, 100, (LPDWORD) &dwTmp, NULL);
for starters, for a 100x100 RGB image, you need to write 300 bytes worth of pixel data per each pixel row. looks like you're only writing 100 bytes total.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
hi , plz help me to read seralnumber harddisk or read sazi darddisk
or read serialnumber mainbord
tnx for help me
nader
|
|
|
|
|
|
kakan wrote: Use GetVolumeInformation(). See here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/getvolumeinformation.asp[^]
Hai Kakan,
Sorry for trouble, little correction buddy.. that api return the Volume Serial Number not the Hardisk or Motherboard..
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hello Alok. You are right (of course).
|
|
|
|
|
yasa294 wrote: hi , plz help me to read seralnumber harddisk or read sazi darddisk
or read serialnumber mainbord
tnx for help me
look at this :-
Computer System Hardware Classes [WMI][^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I would like to check the status of a specific Windows service, that is, I want to programatically check whether a specific windows service is running currently or not.
I would like to know the Win32 API function to accomplish this because I would like to use it in LotusScript. LotusScript uses Win32 API function similar to the VB where you can DECLARE Win32 API function & arguments and call the function in the code.
Thanks in advance
|
|
|
|
|
amigo_rk wrote: I would like to check the status of a specific Windows service, that is, I want to programatically check whether a specific windows service is running currently or not.
SC_HANDLE hSCM = OpenSCManager("SERVER", NULL, SC_MANAGER_CONNECT);
SC_HANDLE hService = OpenService(hSCM, "NameOfService", SERVICE_QUERY_STATUS);
SERVICE_STATUS ss;
QueryServiceStatus(hService, &ss);
CloseServiceHandle(hService);
CloseServiceHandle(hSCM);
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
amigo_rk wrote: I would like to know the Win32 API function to accomplish this because I would like to use it in LotusScript. LotusScript uses Win32 API function similar to the VB where you can DECLARE Win32 API function & arguments and call the function in the code
List of api related to service :-
http://www.codeproject.com/system/AMFSServiceManager.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I have an application that prints Names.
Extended characters are being discarded in the printing. (I.e. À Á Â Ã Ä Å Æ Ç È É Ê Ë).
I am using TextOut() to send the text to the printer. I have tried alternate fonts, alternate charactersets in the font, but nothing seems to change.
The printed text for the above string is always (in different fonts) A A A ? A ? ? C E E E E.
What am I doing wrong? What can I do differently?
Thanks,
Craig
|
|
|
|
|
Hi..
On my Tabcontrol Application,there are some n number of edit boxes(all are created dynamically)..
Now when i am outside the editboxes & press the "End" Button the control will shift to the end of that dialog..Similarly when i am at the end of the dialog and if i press the "Home" button the control should go to top of the dialog..This all is working fine..
I had used the following code which i kept it in the PreTranslateMessage()
if(lpMsg->message == WM_KEYUP && lpMsg->wParam == VK_END)
{
HWND hWnd;
hWnd = this->m_hWnd;
DWORD nPos = ::GetScrollPos (hWnd, SB_VERT);
nPos <<= 16;
DWORD nScrollCode = SB_TOP;
WPARAM wparam = nPos | nScrollCode;
::SendMessage(hWnd,WM_VSCROLL, wparam, 0);
return TRUE;
}
But the Problem is that when the control is in Edit Box & if i press the "End" button the control goes to the end of the text in the edit box and then it goes to end of the dialog which should not happen(the control should go to the end of text in edit box & not to end of dialog)...
i.e when the control is in edit box,the default functionality of "End" button should take place..How can i achieve this?????????
Plz Help ME!!!!
Thanks in Advance....
|
|
|
|
|
I think deriving a class from CEdit and making children of your derived CEdit: CMyEdit should do it. That way you could even ignore some keys if you wanted to, or perform some special action with some keys.
In short, I think you need to do some subclassing of the CEdit control.
this is this.
|
|
|
|
|
I have crated two dlls which contanins
some functions usefull in my application.
I need to include the "lib" file so i do it
from
>Project>Setting >Link>Object/library modules
i just add the name of my dll
dll5.lib
it works fine for fist dll
now i have another lib to include ,it gives me
error
Can anyone tell me the exact way to include the lib file
thank you
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|