|
(assuming you're using MFC/win32 UI code )
you need to handle the resizing of the UI manually, handle the WM_SIZE message and resize and reposition each control.
or you could use a layout manager, have a look here at CP for different layout managers.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
|
Hi all,
i need your help urgently.
i am facing problem with posting a DoModal FileOpenDialog from property sheet. i will explian my problem this way.
I hava a dialog D1 derived from CDialog. in its OnInitDialog(), i created a propertysheet PS1 at run time with D1 as parent, and PS1 having WS_CHILD | WS_VISIBLE as creation styles. PS1 has 2 propertypages - PP1, PP2 - added to it. PP1 has OPEN button. On Clicking OPEN, i need to post FileOpenDialog Box. My code is as below:
D1.cpp
-------
BOOL CD1::OnInitDialog()
{
CPropertySheet *PS1;
PS1 = new CPropertySheet("", this, 0) ;
CPropertyPage *pp1 = new PP1() ;
CPropertyPage *pp2 = new PP2() ;
PS1->AddPage(pp1) ;
PS2->AddPage(pp2) ;
PP1->Create(this, WS_CHILD | WS_VISIBLE) ;
PP1->ShowWindow(1) ;
}
PP1.cpp
void PP1::OnBtnOpen()
{
CString fileName ;
char charFilter[256] ;
char fileExt[100] ;
char *filename ;
strcpy(charFilter, "File Filter (.mmm)|*.mmm|") ;
strcpy(fileExt, "mwf") ;
CFileDialog fileDialog(TRUE, // Open File Dialog
fileExt, // default extension
NULL, // Initial File Name
OFN_HIDEREADONLY |
OFN_OVERWRITEPROMPT |
FILE_ATTRIBUTE_DIRECTORY,
charFilter, // File Filters
AfxGetMainWnd() ); // Parent Window
if( fileDialog.DoModal() == IDOK )
{
return ;
}
}
my application hangs at fileDialog.DoModal().
Please help me in rectifying it.
|
|
|
|
|
Sreenivasa.Murthy.G wrote:
strcpy(charFilter, "File Filter (.mmm)|*.mmm|") ;
filter always end by Double | operator i.e. ||.
this may be causing the problem.
right way to write charFilter is
strcpy(charFilter, "File Filter (.mmm)|*.mmm||") ;
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
How can I detect resource leaks in my VC code. There are several articles on CodeProject which addresses the memory leak detection however I couldn't find any about resource leak detection. Any ideas?
|
|
|
|
|
How are you confirming that resource leaks are happening?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
|
I have a Windows application programmed in C (SDK level) using VC6. My Windows 98 and Windows XP (on different PCs) are set up with task bar "Always on top" & "Auto-hide".
With my application window having the focus and maximised, the task bar pops correctly in Win98 when I bring the mouse pointer to the bottom of the monitor, but on XP, the task bar does not popup.
I register the window as:
memset(&wc,0,sizeof(wc));<br />
wc.style = CS_BYTEALIGNWINDOW | CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;<br />
wc.lpfnWndProc = MainWindowProc;<br />
wc.cbClsExtra = 0;<br />
wc.cbWndExtra = 0;<br />
wc.hInstance = hAppInst;<br />
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);<br />
wc.hCursor = LoadCursor (NULL, IDC_ARROW);<br />
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);<br />
wc.lpszMenuName = NULL;<br />
wc.lpszClassName = szAppName;<br />
<br />
RegisterClass (&wc);
and I create the window as:
hwndPrimary = CreateWindow(szAppName,
szPrimaryTitleBar,<br />
WS_POPUP | WS_BORDER,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hAppInst,
NULL);
and then do:
ShowWindow(hwndPrimary,sw);<br />
<br />
ShowWindow(hwndPrimary, SW_MAXIMIZE);
Note - I use window style WS_POPUP | WS_BORDER because I need maximum size client area. I can't waste space on title bar, thick border, etc.
If I do not maximise the window, the task bar pops up just fine, but the moment the application is maximised (which I need to do), the task bar does not pop up properly. The problem only occurs under Windows XP. When I run the EXE under Win98, the task bar pops up as expected.
Any suggestions?
|
|
|
|
|
Statically linking a project includes all code in dll into exe file, so the dll is no more needed on target machine, how can we do same fo activex controls, ie linking or using in such a way that they are included in exe and no more need for installing/registring on target machines?
|
|
|
|
|
Dll are never statically linked to an exe !! Lib files are statically linked but dll never (a lib file is the same that a dll file, except that here the linkage is static and with a dll the linkage is dynamic).
So, for activeX, you cannot statically link them to your project. You need to install and register them if you want to use them on a target machine.
|
|
|
|
|
i already know how to communicate through th serial port but i am not able to control the CTS, RTS and DTR pins of the Com port.. please tell me how to change the status of these pins in VC++ 6 through API.
syed abdul qavi
|
|
|
|
|
Take a look at the EscapeCommFunction (for setting/clearing RTS and DTR) and at GetCommModemStatus to get the status of the CTS line.
|
|
|
|
|
i m success to setting RTS and DTR but anable to get status of CTS and DSR i m trying GetCommModemStatus but i m not success to get so plz. tell me how to get status of that pins.
thanx
Syed Abdul Qavi
|
|
|
|
|
Hello,
Is there a way to configure the way VC generates the #include statements?
- Keep/Generate header file names case sensitive. (When using the 'Add Variable' wizard to add a member variable to one of your dialogs, the wizard will add the name of the corresponding header file but using lowercase letters)
- Do not use 'Absolute' Paths. (When creating classes, it adds an absolute path to the base class header file when the base class is one of your generic classes)
Is there a way to configure this?.
Is this OS deppendent? (If yes, where to configure it?)
-- Ricky Marek (AKA: rbid)
-- "Things are only impossible until they are not" --- Jean-Luc Picard
My articles
|
|
|
|
|
I want to combine a lot of .jpg Files to an AVI File,what should I do? could you give me example?
|
|
|
|
|
|
|
Hi All,
I try to create some simple applications using WindowsForms. I use Visual Studio .Net 2003, Academic version.
Lets say I have a form and a button.
When I double click on the button, I create an event for click. Then I can
write all the code to deal with that event, and everything works fine. The
only problem I have is that the code gets written in the header file, instead
of being placed in the cpp file.
I have some experience programming with Borland C++ Builder, and I compare the results with the ones from BCB.
I expect that when I add an event, the function definition should be placed in the header file, and the function implementation, in the cpp file.
Did I miss a setup option, or is there an option set up wrong? I don't consider normal that all the code gets written in the header file. What is the right procedure, so that when someone adds an event for a button, the event function to be added to the cpp file?
I tried to move the function from the header file to the cpp file, and to leave the definition of it in the header, but now I get a lot of errors.
To make it worse, the samples provided by Microsoft don't contain code in C++, only VB and C#. Is C++ dying, should I start learning C# instead?
Regards,
Nicolae
|
|
|
|
|
Did the application run?
Nicolae Fieraru wrote:
Is C++ dying, should I start learning C# instead?
No C++ is not dying. There are times when you need C++ to write an application. But you should learn C#, it`s the future language.
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
Yulianto AKA goodmast3r wrote:
C#, it`s the future language
maybe it's yours, but i'm not sure i need it absolutely for what i program...
you use a language because you need its advantages, not because it is a supposed language of the future...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
you use a language because you need its advantages, not because it is a supposed language of the future...
It`s language of the future, because of it`s advantages, simpleness.
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
but admit you don't need all the C#'s features to program a simple HC-11 for example...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Yes true.
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
Yulianto AKA goodmast3r wrote:
But you should learn C#, it`s the future language.
I just have seen some MS-guys marketing the Whidbey compiler saying that C++ will be *the* prime .NET language when it comes to control of the code. It will not be as RAD as VB.NET, but all about control at the coselevel. You can seamlessly go from .NET-Framework to assembler and back to unmanaged C++ in one project.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|