|
If you wrote the other process, the best way is to pass it an event handle and have it signal the event once the init is done. The parent process can then wait on the event. If you can't change the 2nd process, check out WaitForInputIdle()
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Thanks for your helpful answer.
I havn't written the other process but WaitForInputIdle was exactly what I was looking for.
Thans again.
|
|
|
|
|
Hi,
I have a CFormView-based application in which I am having a weird window sizing problem. On startup, my view window is very large vertically. It is so large that I can't see the top or the bottom of the window - it is completely off the screen. In the CView::OnInitialUpdate(), I get the window size by calling GetWindowRect(), then calling OnSize() with the width & height of this rectangle. For some reason, these values are very large (or negative) so that the OnSize() method creates child windows that are way off the screen.
Any ideas for helping me get this fixed would be appreciated.
Thanks,
Royce
|
|
|
|
|
If you use GetWindowRect and ScreenToClient then size from your window isnt right
|
|
|
|
|
RoyceF wrote: For some reason, these values are very large (or negative)...
Wouldn't that be expected since the window starts out too large for the screen?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I have been able to change the background color on my Dialog box, but the background colors are still white on my text boxes and other controls. How does one change the background on those items?
Thanks for your assistance.
John P.
|
|
|
|
|
For edit box
in onctlcolor
OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
if( CTLCOLOR_EDIT == nCtlColor )
{
pDC->SetBkColor( RGB(250, 0, 0 ));
}
}
Dream bigger... Do bigger...Expect smaller
aji
|
|
|
|
|
Thanks for the assistance!
John P.
|
|
|
|
|
In WM_CTLCOLOR message handler set background mode as transparent and return a null brush. This will make the background colour of the controls same as background colour of your dialog
|
|
|
|
|
Thanks for the help!
John P.
|
|
|
|
|
|
|
You can use WM_CTLCOLOREDIT like this
<br />
LRESULT CMyAnswer::OnCtlColorEdit(WPARAM wParam, LPARAM lParam) <br />
{<br />
HDC hdc = (HDC)wParam;<br />
SetBkMode(hdc,0);<br />
SetTextColor(hdc,TextColorEdit);<br />
return (LRESULT)(m_pBrush->GetSafeHandle());<br />
}<br />
|
|
|
|
|
I'm getting a really wierd error. I started it as an empty .NET project, and everything is posted here but the int main() file:
The program compiles without any errors or warnings reported by the debugger, but when it runs, I get this error:
"An unhandled exception of type 'System.NullReferenceException' occurred in NumberConversion.exe
Additional information: Object reference not set to an instance of an object."
It points to this line inside memcpy.asm:
mov [edi],al ;U - write second byte to destination
The code:
Implementation file:
#include "Menu_Class.h"
#include "CommonStructDefs.h"
#include <iostream>
#include <string>
using namespace std;
Menu::Menu()
{
NumMenuOptions = 2;
InitializeMenuOptions();
}
void Menu::PrintOptions()
{
cout<<"Availible menu options:"<<endl;
for(int i=0; i < NumMenuOptions; i++)
PrintMenuOption(i);
cout<<"Please enter a menu option: [1-"<<NumMenuOptions<<"]: ";
}
void Menu::PrintMenuOption(int MenuOption)
{
cout<<MenuOptions[MenuOption].OptionNumber<<". ";
cout<<MenuOptions[MenuOption].OptionName<<": ";
cout<<MenuOptions[MenuOption].OptionDescription<<endl;
}
void Menu::InitializeMenuOptions()
{
for(int i=0; i < NumMenuOptions; i++)
MenuOptions[i].OptionNumber = i + 1;
MenuOptions[0].OptionName = "Decimal -) Binary";
MenuOptions[1].OptionName = "Binary -) Decimal";
MenuOptions[2].OptionName = "Exit Program";
MenuOptions[0].OptionDescription = "Convert a base 10 number to a base 2 number.";
MenuOptions[1].OptionDescription = "Convert a base 2 number to a base 10 number.";
MenuOptions[2].OptionDescription = "Exit the program.";
}
Specification file:
#include "CommonStructDefs.h"
#ifndef MENU_CLASS_H
#define MENU_CLASS_H
using namespace std;
class Menu
{
public:
Menu();
void PrintOptions();
void PrintMenuOption(int MenuOption);
protected:
private:
void InitializeMenuOptions();
int NumMenuOptions;
MenuOptionType MenuOptions[2];
};
#endif
Defenitions:
#include <iostream>
#include <string>
using namespace std;
#ifndef COMMON_STRUCT_DEFS_H
#define COMMON_STRUCT_DEFS_H
struct MenuOptionType
{
string OptionName;
string OptionDescription;
int OptionNumber;
};
#endif
Any help would be appreciated.
-- modified at 16:55 Monday 7th August, 2006
|
|
|
|
|
CoffeeAddict19 wrote: MenuOptions[2].OptionName = "Exit Program";
CoffeeAddict19 wrote: MenuOptionType MenuOptions[2]; //structure of menu options
|
|
|
|
|
Hello all,
I have a simple server written in MFC as a dialog box application. I find the page fault to increase and rapidly and this inturn increasing the memory size when there are many TCP connection requests to the server. But as soon as I press the minimize button, the memory abruptly returns to 400K and again starts building up. For testing case, we are using the debug version. Does the debug version have a bug like this (which otherwise means that the release version will not have this bug?)? Is there a much bigger problem in my code?
Please help me.
Thanks in advance
Regards
Varchas R S
|
|
|
|
|
The memory footprint for Debug versions will be larger than Release versions, but this isn't what you are seeing. This is most likely a bug in your code and you should investigate it (sounds like a memory/resource leak from what you described).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
OK . .But why is it when I minimize, I always go back to the minimum possible memory ..i.e. 384K ..then it starts building up. The server receives something like around 10 connections per second and this can cause memory leaks that also I agree, but how come when minimizing it returns to 384K? When I restore it, because of SHOW_WINDOW, it takes another 300K and the memory becomes 700K. But it again starts increasing. .to a huge number. .even 110MB .. :-S but one minimize click . .returns to 384K. ..
Will look at memory leaks too!
Thanks
Varchas R S
|
|
|
|
|
Varchas R S wrote: ...the memory abruptly returns to 400K and again starts building up.
How are you verifying this?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Using Task Manager!! .. we have hosted the server and the connections per second is more than 10. so quite a lot of socket creation and socket closing that is done.. but minimizing the window is flushing some memory ... its strange ..
|
|
|
|
|
Varchas R S wrote: Using Task Manager!!
Which is not the best tool for what information you are after. Task Manager is simply reportng to you is the address space currently in use.
Varchas R S wrote: ...but minimizing the window is flushing some memory ... its strange ..
This is not strange at all. In fact it is quite expected. When a program's main window is minimized, the memory that the OS had reserved for it can be freed. If the window is restored, the OS must once again allocate memory for it.
See here for more.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
If you do the follwing in VB6
<br />
Dim myVar as Boolean<br />
myVar = True<br />
<br />
Debug.Print myVar<br />
you'll see a 'True' in the debug window, but only on an english system, the string is actualy language dependent.
My problem now is that I need to read a text file that was written with VB6 with C++.
Therefore I need a list of the languages VB6 was shipped and the used strings to represent the value of a Boolean.
I know that this is more a VB than C++ question, but I don't know any good VB forum
Thanks
|
|
|
|
|
ABuenger wrote: but I don't know any good VB forum...
Including this one?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Including this one?
I thought it is only for VB.NET
|
|
|
|
|
i have displayed the valuess from database. when i change the TAB IN DIALOG it should not read from database.it should store the values in local structure.and when ever the TAB changes it display the values from the structure.how it is possible?
|
|
|
|