|
Hi, I have a small problem with my SDI app. There are several modal dialogs in the program. Sometimes, if I activate a different program and then press alt+tab, or even click on the program in the taskbar, only the modal dialog is brought to the foreground. The main SDI window does not appear below the dialog. This only happens when some of the dialogs are shown, but they are all created in the same way! To show the dialogs I do:
CMyDialog dlg(AfxGetMainWnd());
if (dlg.DoModal() == IDOK) {
...
}
Please help if you can. I've just spent hours searching through messages and couldn't find anyone who had a similar problem.
By the way, I'm running Windows XP, but I have the same problem under Windows ME.
Thanks!
|
|
|
|
|
Hi i need to Uninstall a program programmatically. ie. Programmatically simulating Add/Remove option from control panel .Any help ?
|
|
|
|
|
Have a look in the registry
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall
There all uninstallable programs are registered.
Some notes on the keys which can be found there:
- "DisplayName" is the displayed name in the listbox.
- "UninstallString" tells you which command is executed when the user clicks the "Add/Remove" button in the control panel.
|
|
|
|
|
Hi.
I would like to change the initial location of a dialog box (modal and/or modeless.
For example, in the program I can current working on, Windows paints the the modal dialog box in th center of the program. I have to move the dialog box to the size to see the main window. I would like to change the initial location of a dialog box.
Thanks,
Kuphryn
|
|
|
|
|
Use the MoveWindow API call
Nish
If I am awake and my eyes are closed, it does not necessarily mean that I am thinking of naked women.
|
|
|
|
|
OnInitDialog() is called before the dialog is actually shown. In this function, use either SetWindowPos() or MoveWindow() to change the window position. In this way, when it is shown it will appear initially in the correct place.
I would strongly suggest that if this is a commonly used dialog you save and restore the window position; this way users can put it whereever they want it, and it will appear there initially from then on.
Sometimes i only remember, The days when i was young Nowadays no one remembers when they were young and stupid... ADEMA, The Way You Like It
|
|
|
|
|
Thanks.
MoveWindow(...) works great.
Now I just need to save the position in the registry.
Kuphryn
|
|
|
|
|
kuphryn wrote:
Now I just need to save the position in the registry.
May I ask you why do you want to do this?
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
Sure. Shog9 implied that the dialog box should at the last position before the user closes it. The only way to do that is to save its last position int he registry.
Kuphryn
|
|
|
|
|
I would like to know what this printprocessor means for PRINTER_INFO_2 while using Addprinter. Basically i am trying to add printer programmatically but i cannot succed. Any help is most appreciated.
Somu.l
|
|
|
|
|
I want to read from file ,line be line and after reading each line modify it and write modify string to file.I use this code:]
CStdioFile inFile;
inFile.Open(strpath , CFile::modeReadWrite | CFile::typeBinary);
char buf[80];
while(inFile.ReadString(buf,5))
{
CString outdatastring;
for (int i =0 ;i < 5; i++)
{
}
inFile.WriteString(outdatastring);
}
inFile.Close();
But I got this error after in run time:
Disk full while accessing F:\Doc\Change List - Beta2 to RTM.doc.
Any suggestion?
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
First question: you use CStdioFile, why do you open the file with the CFile::typeBinary parameter?????? Normally CStdioFiles are opened with CFile::typeText! If you need to read binary data you should use the normal CFile class. My suggestion: change CFile::typeBinary to CFile::typeText.
Second question: why is the char buf[80] 80 chars long and you use only 5 chars of it? My suggestion: read the COMPLETE string (can be much longer than 80 chars, so extend the size of buf) and then process only the first 5 chars. Thats much better. I don't know how ReadString reacts when it doesn't reach the end-of-line character and then is called again.
|
|
|
|
|
is there a notification message that will tell me when a dialog has finished initializing for the first time?
thank you
|
|
|
|
|
hi friend
wut u want??
for y u specify at first time????
WM_INITDIALOG is a message will post when a dialog initiates..
i think u aimed to do some trick with single instance...am i right??
Renjith
Hai Friends me from Pandalam..and i think there is a sofware behind everything...
so enjoy with the codes...
|
|
|
|
|
WM_INITDIALOG happens when the dialog is about to inialize. i have a function that i want to run after the dialog is inialized.
|
|
|
|
|
I"m not sure about this, but
BOOL m_bFirstPass;
CDialog:CDialog()
{
m_bFirstPass = FALSE;
}
CDialog::OnInitDialog()
{
m_bFirstPass = TRUE;
}
CDialog::OnActivate()
{
if(m_bFirstPass == TRUE)
m_bFirstPass = FALSE;
}
This might work!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hi
We have a problem adding message handling functions for Non Dialog Controls in MFC with Visual C++ 7.0.
We cant find a way to do this the easy way. The Class Wizard which existed under 6.0 doesn't exist here, and thru the events in the properties of a class only menu and accelarator IDs are accessible. None of the Buttons from a Toolbar for example is available.
Thanks
Lars
|
|
|
|
|
Well, first of all, in most cases where you have toolbar buttons, you should also have a corresponding menu item, or at least an accelerator. In these cases, the Events property sheet will work. If you absolutely cannot have a menu or accelerator for your button, it is trivial to add the message map entry manually:
ON_COMMAND(Command ID of button, Handler function)
Sometimes i only remember, The days when i was young Nowadays no one remembers when they were young and stupid... ADEMA, The Way You Like It
|
|
|
|
|
Is there any way GDi objects can be trapped,ie Images of the application.At the operating system level,Probably Input output request packet(irp) form the gdi objects,but that would involve hooking the kernel....
Thanks for spending time...
Vineet Sharma
|
|
|
|
|
You can try API Capture. Someone just posted an article on this topic. With this technique you could trap all of the GDI calls from a particular app, change the calls, or just spy on them, it up to you.
Checkout my Guide to Win32 Paint for Intermediates
|
|
|
|
|
I know this is the C++ forum, however it was the suggestion of another to post this question here. Suppose someone were writing a "firewall" application that was "watching" or listening for activity over an incoming IP address, what is the best way to cover all ports. In all the examples I have read, someone creates an instance of TcpListener and supplies a port to listen to. Surely you don't have to do that for each of the 65,000+ ports. Could someone lead me in the right direction. I am going to do this in C#, Thanks in advance.
Nick Parker
|
|
|
|
|
OS only uses a predefined number of ports ..even there is more than 64000,like HTTP(80),FTP(21 i think...not sure ) such like...
Hai Friends me from Pandalam..and i think there is a sofware behind everything...
so enjoy with the codes...
|
|
|
|
|
Hi,
I use the htonl() fonction to convert an IP address from "host byte order" to "network byte order" but it does not work, or sometimes it work and sometimes not!!!.
here is the portion of code that i used to display the IP address :
in_addr addr;ip = htonl(ip);// ip is an u_long already initialized
addr.S_un.S_addr = ip;char* dst = inet_ntoa(addr);AfxMessageBox(dst);
what is going wrong ?
|
|
|
|
|
WSAStartup ?
|
|
|
|
|
hi friend
char szHostName[256];
char szIpAddress[256];
WSADATA wsaData;
HOSTENT *pHP;
SOCKADDR_IN myaddr;
myaddr.sin_family = AF_INET;
if (InitialiseSocket(wsaData))
{
gethostname(szHostName,256);
pHP = gethostbyname(szHostName);
memcpy((char FAR *)&(myaddr.sin_addr), pHP->h_addr,pHP->h_length);
wsprintf(szIpAddress,"%d.%d.%d.%d",myaddr.sin_addr.S_un.S_un_b.s_b1,myaddr.sin_addr.S_un.S_un_b.s_b2,myaddr.sin_addr.S_un.S_un_b.s_b3,myaddr.sin_addr.S_un.S_un_b.s_b4);
WSACleanup();
}
i t will solve ur problem..it is easy & cool ....
u will get the IP address in szIpAddress Buffer
try it now..!!
Renjith
Hai Friends me from Pandalam..and i think there is a sofware behind everything...
so enjoy with the codes...
|
|
|
|