|
Hi,
I have a CDialogBar derived dialog which is automatically resized by the OS when the user switches from standard size (96dpi) to 120dpi. The problem is, that only the CDialogbar is dependend from the font sizes, and all the other CToolbars have the standard size.
Is is possible to prevent the dialog from being resized by the OS? Maybe by setting the fontsize permanently for the dialog to -11 ?
Thanks
|
|
|
|
|
madmax0001 wrote: Is is possible to prevent the dialog from being resized by the OS? Maybe by setting the fontsize permanently for the dialog to -11 ?
you have to associate the CFont class of Font Size 11 with all member of Dialog Text
"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
|
|
|
|
|
I use ::ShellExecute() function for run some application
but I don't know when I want to close it how I write the code.
What's function use for this issue?
|
|
|
|
|
You can use TerminateProcess() but the spawned process should terminate itself.
You don't have any way to know what state the other process is in when you use TerminateProcess().
Mark
|
|
|
|
|
As you say, "you don't have any way to know what state the other process is in when you use TerminateProcess()." In particular, you don't know if it's in a safe state to terminate. For example, it could have half written out a file and when killed the file is corrupted. Way too many people use TerminateProcess as if it's an acceptable way to close a process; it's not - only when all else fails.
Here's what MSDN has too say on this issue:
"The TerminateProcess function is used to unconditionally cause a process to exit. The state of global data maintained by dynamic-link libraries (DLLs) may be compromised if TerminateProcess is used rather than ExitProcess.
TerminateProcess initiates termination and returns immediately. This stops execution of all threads within the process and requests cancellation of all pending I/O. The terminated process cannot exit until all pending I/O has been completed or canceled.
A process cannot prevent itself from being terminated."
Don't get me wrong, I know you did allude to this in your post. I like to point this out explicitly however as not to accidentally encourage bad practice.
Steve
|
|
|
|
|
Thanks man! I knew and when I reread my post I thought the point got lost in the first
sentence.
Apparently I'm not the only one who thought so
Hopefully the OP will read this too!
Cheers,
Mark
|
|
|
|
|
Max++ wrote: I use ::ShellExecute() function for run some application
but I don't know when I want to close it how I write the code
You can post to the application the WM_CLOSE message (to close it gently), provided you can obtain the application main window handle.
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.
|
|
|
|
|
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
|
|
|
|