|
if the application handles that message and decides not to close, the OP won't be able to enforce with this...
|
|
|
|
|
Actually you should first try to close gently the application and then, if the application doesn't close itself, force it to close abruptly using TerminateProcess() . Even Windows conforms to this behaviour when needs to close applications (for instance when a shutdown is issued).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
but how to know that a "gentle close" failed ?
|
|
|
|
|
In fact there are a lot of ways. If you created the process then you can use GetExitCodeProcess (because you have the process handle).
On the other hand, if you haven't the process handle, you can use the window handle to discover if the window is already alive, if the application is hung, etc.. (for instance using SendMessageTimeout() .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
The best way is to use WaitForSingleObject on the process HANDLE . Process HANDLE s are waitable objects which become signalled when the process they represent no longer exists.
Steve
|
|
|
|
|
Yeah, provided you need to wait for.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Use WaitForSingleObject on the process HANDLE . Process HANDLE s are waitable objects and they become signalled when the process no longer exists.
Steve
|
|
|
|
|
|
Max++ wrote: What's function use for this issue?
What about sending WM_QUIT message to particular application
"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
Support CRY- Child Relief and you
|
|
|
|
|
Hi..
I have created one dialog box and now i want to initialize text on my dialog box..
How can i initilaze my data on dialog box ?
MY code is..
BOOL Exchanger::OnInitDialog(void)
{
// m_ExchListbox.AddString(_T("Hello"));
static char m_myarray [] =
{
"Exchanger-Double end\n"
"Exchanger-single end\n"
"Exchanger-Double end kettle\n"
"Exchanger-Single end kettle\n"
"Exchanger-Super\n"
"Exchanger-Process Flow\n"
};
CDialog::OnInitDialog();
return 0;
}
Thanking you..
Shah
|
|
|
|
|
use SetWindowText() on each control you like ...
|
|
|
|
|
Thank you for your reply..
My code is like...
CDialog::OnInitDialog();
m_ExchListbox.AddString(_T("Exchanger-Double end"));
m_ExchListbox.AddString(_T("Exchanger-Single end"));
m_ExchListbox.AddString(_T("Exchanger-Double end kettle"));
m_ExchListbox.AddString(_T("Exchanger-Single end kettle"));
m_ExchListbox.AddString(_T("Exchanger-Super"));
m_ExchListbox.AddString(_T("Exchanger-Process Flow"));
Is it possible to declare it in array ??
i.e something like this..
static char m_myarray [] =
{
"Exchanger-Double end\r\n"
"Exchanger-single end"
"Exchanger-Double end kettle\n"
"Exchanger-Single end kettle\n"
"Exchanger-Super\n"
"Exchanger-Process Flow\n"
};
and then i can call through
m_ExchListbox.AddString(m_myarray); ( but here addstring ( it will take only Cstring not char.. i tires with char then its showing me error)
Is it possible to declare through array ??
Thanks a lot..
Shah
|
|
|
|
|
You can set your text of property window of dialog
|
|
|
|
|
Hi..Thanks for your help..
If possible then can u give me favor of my above question??
Shah
|
|
|
|
|
Shah Satish wrote:
CDialog::OnInitDialog();
do you what ever you want but do it after CDialog::OnInitDialog()
"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
Support CRY- Child Relief and you
|
|
|
|
|
Hi..Thanks for your help..
If possible then can u give me favor of my above question??
Shah
|
|
|
|
|
Hi,
I need to pass a relativly complicated struct into a dll calling a CORBA Service which has to be written in vc6.0 and it has to contain many elements which are necessary to create an input for a service.
Unfortunately I can see only the first array element, other are ignored.
Here an example of c# code:
<br />
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]<br />
public struct MyStrStruct3<br />
{<br />
public string FirstName;<br />
public string FamilyName;<br />
public int size;<br />
}<br />
<br />
[DllImport(@"C:\Projects\CorbaLib60\Debug\CorbaLib.dll")]<br />
private static extern int TestMe(ref MyStrStruct3[] pstr);<br />
<br />
MyStrStruct3[] Names = new MyStrStruct3[2];<br />
Names[0].FamilyName = "Konieczny";<br />
Names[0].FirstName = "Marek";<br />
Names[0].size = 3;<br />
Names[1].FamilyName = "OtherName";<br />
Names[1].FirstName = "OtherFirst";<br />
Names[1].size = 2;<br />
int miki1 = TestMe(ref Names);<br />
C++ code look like this:
<br />
typedef struct _MyStruct2<br />
{<br />
char* FirstName;<br />
char* FamilyName;<br />
UINT size; <br />
} MyStruct2;<br />
<br />
<br />
int TestMe(MyStruct2* pStruct[])<br />
{ <br />
int Size = 2;<br />
<br />
for (int i=0; i<Size; i++ )<br />
{<br />
int woofie = pStruct[i]->size;<br />
char* miki = pStruct[i]->FamilyName;<br />
char* miki1 = pStruct[i]->FirstName;<br />
}<br />
return 42;<br />
}<br />
I define export :
<br />
<br />
__declspec(dllexport) int TestMe(MyStruct2* pStruct[2]);<br />
<br />
It works, but only for first element.
Marek
|
|
|
|
|
I am surprised it worked at all!
The structure has pointers to memory and unless you are sticking the memory for the strings onto the end of the memory for the structure, I am not seeing how the memory for the strings are getting into the DLL.
This seems like more of a C# problem than a problem with the DLL you are calling - might be better to post this to the C#-related message board.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
You should look up the MarshalAs attribute, especially with the UnmanagedType.LPTStr and UnmanagedType.LPArray parameters.
And I have to agree that this question would fit better into the C# forum.
Regards,
Tim
|
|
|
|
|
Hello everyone
i need to have an activex that behaves as a modal dialog
so i need to create it dynamically and show it as modal dialog
anyone can help me with this?
|
|
|
|
|
Whenever I run some fullscreen games (not all, curiously), the Network Status and Task Manager's CPU usage icons (sitting in the systray) redraw themselves on top of the game's display every couple of seconds, creating some annoying flicker. I've noticed that this problem happens with *some* video drivers...one version will have that problem, another version won't...I usually try to keep up to date with my drivers, and the problem comes and goes. You'd think if the problem got fixed in version X, then it would remain fixed in version X+1. It seems like a crapshoot.
My solution is to uncheck the "Keep the taskbar on top of other windows" option before launching a game (and then re-check it when I exit), but having to do this every time is annoying, to say the least.
I thought I could write some little utility to toggle that option, so I could write a batch file to call it, run the game, and afterwards call the utility again to reset the setting.
My question is, how do I programmatically change that setting?
I suppose changing the taskbar's "autohide" setting would also work, so if anyone knows how to do either...?
|
|
|
|
|
See this[^] article. This should help you.
|
|
|
|
|
Interesting.
However, that's not quite what I'm after. I want to programmatically change the "Keep the taskbar on top of other windows" option, not merely display the dialog box that presents this option. I mean, ultimately, when you check/clear that checkbox, some API eventually gets called or some registry setting gets changed. This API/registry entry is what I'm after, so I can change the setting without showing some UI or involving the user.
As far as I can see, this just programmatically displays various dialog boxes.
|
|
|
|
|
Daniel Desormeaux wrote: want to programmatically change the "Keep the taskbar on top of other windows" option, not merely display the dialog box that presents this option.
Just wait a moment I can bang in something for you. I remember doing this.
|
|
|
|
|
Daniel Desormeaux wrote: However, that's not quite what I'm after. I want to programmatically change the "Keep the taskbar on top of other windows" option, not merely display the dialog box that presents this option.
Hurray Dan, Gotcha,
Msg 0x02b1 WPARAM 0x7 Taskbar always on top
Msg 0x02b1 WPARAM 0x8 Taskbar normal.
For Eg:
<br />
::SendMessage(hShellWnd, 0x2b1, 7, 0);<br />
::SendMessage(hShellWnd, 0x581, 1, 0);<br />
::SendMessage(hShellWnd, 0x550, 0, 10001);<br />
<br />
<br />
::SendMessage(hShellWnd, 0x2b1, 8, 0);<br />
::SendMessage(hShellWnd, 0x581, 1, 0);<br />
::SendMessage(hShellWnd, 0x550, 0, 10001);<br />
::SendMessage(hShellWnd, 0x579, 0, 0);
You will have to check this code. It worked for me sometime back. Hence not sure.
I got this from spy++ sometime back.
|
|
|
|