|
Hi,,
I like to know how can I name sub-menu's dynamically.
I mean, its name has to be chaged in different stages of the program,,
Any ideas???
thanks
Ehsan Behboudi
|
|
|
|
|
Hi All,
I have a NT Service.I want to shut down the service without the interpretation of SCM.So, I calling CServiceModule::Handler() with opcode "SERVICE_CONTROL_STOP" and the service to shutdown.But, my service is shutting down at the same time it's giving error "Error :2140 An Internal error occured" .
How can I rectify the problem.I would like to know what happens after I say service shutdown.
Thanx in advance for the help.
Regards,
yamini
|
|
|
|
|
Try this:
http://support.microsoft.com/support/kb/articles/Q115/8/29.asp
Kind regards,
Martin
|
|
|
|
|
Hi,
Thanx for the idea.But, I am using ATL Service.I ahve a function CServiceModule::ServiceShutDown() & the function code goes as below.
void CServieModule::ServiceShutDown()
{
SetServiceStatus(SERVICE_STOPPED);
PostQuitMessage(dwThreadID,WM_QUIT,0,0);
}
I am calling this function from CServiceModule::Run() before the Loop and I put a MessageBox in CServiceModule::Handler() case SERVICE_CONTROL_STOP to indicate that the service is stopped.When I try to start the service thro' SCM I am getting MessageBox and also error that "Error :2140 An internal Error occured>".
How can I update the SCM UI and notify that the Service has terminated(When the service terminates instead of Error I need to notify that Service cannot be started ).I mean, how can I terminate the service without such errors as I am using ATL generated Code & I want to achieve the service termination with this ATL Generated Code only.
Thanx.
|
|
|
|
|
SCM shows error 2140 in a case, when your service terminates with 'process return value' equal to 0. You have to find a way, how to return proper value (!= 0) when service process terminates. However, I cannot help you with ATL service class, because I have never used it - sorry.
|
|
|
|
|
I had the same problem.
I made this.
I saw that the problem was that the service didn't stop normally.
You have a thread that is dowing the service but the service didn't know that.
I put saome global variables for that.
For example when I recive the SEVICE_CONTROL_STOP I update a variable like
bRuning = FALSE;
In the Run I always Ask about this variable, I if I find that this variable is FALSE, I go out. (Kill all process like threads, etc, and go out from Run.)
Sometimes the problem is an error in the code that you in debug mode don't see.
I work with trace file and with the Event log for test my Release version. Sometimes I have a mistake.
I hope to Help!!!!
Regards
Carlos Antollini.
|
|
|
|
|
the tree control sends a notify message. How do I extract the TVN_SELCHANGED message from the message? I need somethin like this:
case WM_NOTIFY:
switch (LOWORD(lParam))
{
case IDC_MYTREE:
{
if (HIWORD(lParam) == TVN_SELCHANGED)
dostuff();
break;
}
}
Should be kinda simple, but couldn't find it anywhere in a sample or in the help files
thanks,
WAVK
|
|
|
|
|
lParam points to a NMHDR structure, or a structure that contains NMHDR as a first member. NMHDR has a member named 'code', containing the notification code. Expression that tests the notification code looks like this:
((NMHDR)lParam)->code
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
the NMHDR has to be LPNMHDR in my case, but perfect!
|
|
|
|
|
the NMHDR has to be LPNMHDR in my case
Sure! I've forgot to include '*' in the cast expression. LPNMHDR is just a typedef for 'NMHDR *'.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I have list control and its operation is just like the explorer
But when I sorting this list control the directory and files and mixed.
How can I sort it separately like explorer
|
|
|
|
|
Hi,
I'd like to know how can I fill region
with 50% OPACITY white color ?
I need it for hiliting .
Probably the answer is alpha channel functions ( Win2k ) or
OpenGL , but I want to be as simple as possible and working
under Win95 and higher.
Thanks !
|
|
|
|
|
The current issue of WDJ has an article on how to get ahold of the bits of a bitmap and iterate through them, it shows some simple filters. Next month my article on an alphablend function for W95 will be published, but it basically uses the techniques shown by the tech tip in question - copy your bitmap to a DIBSection, iterate through the bits to modify and copy back.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
Actually , I don't wanna deal with copying bitmaps back and forth.
I need smth like
FillRgn(
HDC hdc, // handle to device context
HRGN hrgn, // handle to region to be filled
HBRUSH hbr // handle to brush used to fill the region
)
function modified sucha way that it will be able to draw x% opacity
color.
|
|
|
|
|
The region thing may be interesting, but the point of what I said is it is buried in a function, so all you have to do is pass in the HDC that holds the bitmap.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
I have created a dlgbox with combo box. In the style properties of it i have selected option drop list. But when i run the dlgbox, i could select the data only when i write the first letter of it and after i could choose other thanks to the keyboard.So, my problem is that i couldn't select the data directly with the combobox, e.g, when i click on the combobox it doesn't show all the data we could choose. WHY?
thanks in advance
gerald
|
|
|
|
|
You need to change the dropdown height. In the dialog editor, click on the combo's arrow button and drag the resize handles to increase the height.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi All,
We've developed a fair sized application in Visual C++ 6.0. The App is supposed to run on all Windows (NT, 9x, 2000) platforms. Primarily we developed the App on Windows NT and it runs just fine. But when we run it on Windows 98, strange things happen. The system font i.e. the font in all Windows gets changed and strange messages, which are in the resource file from the past but we don't use, appear. We are deleting all GDI objects that we create in the App. We'll highly appreciate any idea about the reasons or pointers to any helpful articles.
Thanks,
Asif
|
|
|
|
|
We are deleting all GDI objects that we create in the App.
This is not enough. Probably your objects are selected into some device context when you're deleting them. MFC objects are freed, but their GDI counterparts are not. The result is GDI resource leak.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thanks Tomasz. It worked. The problem was the code like the following:
font.DeleteObject();
pDC->SelectObject(pFontSave);
We just reversed the order of the two lines and the thing is working. In the beginning we were assuming that the CGDIObject destructor deletes the associated GDI object and since we were using local variables we were sure that the destructor was called. Then we called DeleteObject() but it doesn't work while the object is selected in a DC.
Thanks again.
Asif
|
|
|
|
|
Assuming that 'font' variable is a local, you don't even need to call DeleteObject() manually, destructor will do it for you when object goes out of scope. The problem is that DeleteObject will fail if object to be deleted is still selected in some DC.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi Tomasz,
One thing I always asked myself: do SaveDC/RestoreDC work the same?
I suppose so, as long as you call RestoreDC before objects destruction.
Is this right?
Paolo.
|
|
|
|
|
do SaveDC/RestoreDC work the same?
Yes, RestoreDC should de-select objects selected after SaveDC. The real question is: what's the performance impact of SaveDC/RestoreDC? Without a profiler session, I can't give you any real advice. I think that using SaveDC/RestoreDC in small functions called in tight loops could cripple the performance, but that's only a guess.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
That's what we thought and we always select the saved objects before leaving the scope. But the thing just wasn't working in Windows 95. It only worked after we excplicitly called DeleteObject().
|
|
|
|
|
Hello !!
I want to take the system into sleep state aand wake the system after say 10 seconds..
I am using the API SetSystemPowerState(). I have used Setwaitabletimer for 10 seconds to fire an signal after 10 seconds so as to wake the system and come out of sleep state.The system is going into sleep state and then returning from sleep after 10 seconds(indicator lights on the monitor changes but nothing appears on the screen) but nothing on the screen is visible afterwards. Only when I press a key or move the mouse does the monitor gets refreshed. Is there some problem in the permissions set???
Can you please help.
I have used the following:
OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,&hToken));
LookupPrivilegeValue(NULL,SE_SHUTDOWN_NAME ,&tkp.Privileges[0].Luid);
AdjustTokenPrivileges(hToken,FALSE,&tkp,sizeof(TOKEN_PRIVILEGES), &oldtp&dwSize);
Sandeep
|
|
|
|