|
|
Pls advice me How to Increase the hight of the status bar in MDI applcation (working on MFC)
Thanks
|
|
|
|
|
I had to do this early on in my MFC career and I did it by enlarging the font associated with the status bar. (I had to display some icons in the panes and they were getting clipped.)
I am sure there is a better and more elegant way, though... Maybe overriding the drawing/measuring of the status bar?
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></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! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
1. Derive a class say CMyStatusBar from CStatusBar
2. Override method OnCreate.
3. Add the following code after calling create
CStatusBarCtrl& BarCtrl = GetStatusBarCtrl();
BarCtrl.SetMinHeight( 40 ); // The new width of status bar
Open CMainFrm.h
Include the header file MyStatusBar.h
Replace CStatusBar m_wndStatusBar; with CMyStatusBar m_wndStatusBar;
This should work
|
|
|
|
|
can anybody tell me how to set static IP address using c++ code using win32 API.I am doing it in following way:
InitializeWMI();
const BSTR ClassName = SysAllocString(L"Win32_NetworkAdapterConfiguration");
const BSTR AdapterName = SysAllocString(ADAPTER_INDEX);
const BSTR MethodName = SysAllocString(L"EnableStatic");
IWbemClassObject* pClassObj = NULL;
IWbemClassObject* pInClass = NULL;
IWbemClassObject* pInInstClass = NULL;
IWbemServices *pSvc = NULL ;
LONG index[1]={0};
HRESULT hr = pSvc->GetObject(ClassName,0,NULL,&pClassObj,NULL);///at this point its showing unhandled exception
can anybody help???
|
|
|
|
|
an89 wrote: InitializeWMI();
const BSTR ClassName = SysAllocString(L"Win32_NetworkAdapterConfiguration");
const BSTR AdapterName = SysAllocString(ADAPTER_INDEX);
const BSTR MethodName = SysAllocString(L"EnableStatic");
IWbemClassObject* pClassObj = NULL;
IWbemClassObject* pInClass = NULL;
IWbemClassObject* pInInstClass = NULL;
IWbemServices *pSvc = NULL ;
LONG index[1]={0};
HRESULT hr = pSvc->GetObject (ClassName,0,NULL,&pClassObj,NULL);///at this point its showing unhandled exception
Well, for starters it looks like pSvc is still NULL so that would cause the exception...
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></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! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
The problem is in synchronize mode (SND_SYNC) PlaySound Function will block any GUI update calling before the function it self.
Since in MSDN it state that PlaySound with SND_SYNC parameter will not return until the sound is finished playing.
So I expect that any GUI-call calling before PlaySound should take an effect before playing the sound.
eg
this->m_editName.SetWindowText(_T("My name"));
this->m_buttonShow.EnableWindow(FALSE);
PlaySound(_T("c:\test.wav"),NULL,SND_SYNC);
this suppose to update the two control before start playing sound (in synchronize mode) ,
instead the control update after the sound had been played.
putting Sleep() after line two doesn't help either.
since I need my program to play the sound in synchronize mode (blocking any call until the sound is finish playing)
so SND_ASYNC cannot be use.
|
|
|
|
|
Every window updation is happening via MESSAGES. In your code, the PlaySound is blocking the windows MESSAGES as well. To overcome this problem you can insert the following code just before the PlaySound function.
MSG msg;
CWinApp* pApp = AfxGetApp();
while(PeekMessage(&msg,0,0,0,0))
pApp->PumpMessage();
|
|
|
|
|
Rather than doing a peek / message pump, which is very vulnerable to errors, you can simply do UpdateWindow.
Ie:
m_editName.SetWindowText (_T("My name"));
m_buttonShow.EnableWindow (FALSE);
m_editName.UpdateWindow ();
m_buttonShow.UpdateWindow ();
Hope that helps,
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
everyone , Thank for your answers.
|
|
|
|
|
I want to move a captionless dialog by clicking on the Move sub-item of menu bar which is poped up after clicking the dialog's icon on the title bar.
Can anybody help?
Ummar
<div class="ForumMod">modified on Monday, July 7, 2008 7:52 AM</div>
|
|
|
|
|
One approach is to handle WM_SYSCOMMAND, where from ID you can check whether SC_MOVE is clicked or not. Then you can position the window by using various API.
|
|
|
|
|
Hi All,
I have a legacy application in which i am deleting an entry in the registry like
lRet = ::RegDeleteKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\MySoftware\\Entry1");
This is returning GetLastError() as "Access Denied" ,which is perfectly true on Vista due to security contraints.
But i need this to be working on Vista for standard user.
Is there any way to overcome this issue.
Thanks,
Appu..
"Never explain yourself to anyone.
Because the person who likes you does n't need it.
And the person who dislikes you won't believe it."
|
|
|
|
|
As far as I know there is no way for a standard user to delete keys in HKEY_LOCAL_MACHINE.
-Saurabh
|
|
|
|
|
Standard Users CANT modify the HKLM Registry. It is one of the security improvements in Vista.
To do such deleting you need an app that is running in admin-mode. An uninstaller would be approbiate. I use special exe-module in elevated mode for these tasks.
Greetings from Germany
|
|
|
|
|
Thanks for the replies.
Do you mean to say that, i need to change the design if at all i want to work well for standard user.
If that is the case, what is the better solution.
I got a solution for replacing the registry stuff with My.Settings (http://msdn.microsoft.com/en-us/library/ms379611(VS.80).aspx[^]). But this is related to VB.
Do we have any such things available in VC++.
Thanks again.
Appu..
"Never explain yourself to anyone.
Because the person who likes you does n't need it.
And the person who dislikes you won't believe it."
|
|
|
|
|
NiceNaiduo you mean to say that, i need to change the design if at all i want to work well for standard user.
Yes that's exactly the idea.
-Saurabh
|
|
|
|
|
Hi,
I was in need of MD5 hashing to one of project, and found the URL http://www.md5hashing.com/ useful. Downloaded the C++ files and included the same to the project and able to hash strings.
But the problem I am facing here is, it works fine with 32 bit machines but it fails in 64 bit machines/OS. So please let me know how to resolve this problem. Is there any other set of code available which works for bit 32 bit and 64 bit?
Thanks,
Nandu.
|
|
|
|
|
|
Hello guru developers,
I have a project which i have to use a lot of memory allocation, the project works fine except when there are a lot of data the process is killed by Linux, i don't know why? For example this example: it should exit when there is no free memory, but it is killed after some time when i run this program,
Does anyone has any idea how to solve this problem in Linux?
thanks in advance
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <list>
#include <time.h>
using namespace std;
struct tree_node
{
list<tree_node*> leaf;
char data;
short IsEndPoint;
};
int main()
{
try
{
for (int i = 0 ; i < 9999000; i++ )
{
tree_node* t = new tree_node[1000];
printf("id: %d \r ", i);
}
}
catch(...)
{
cout<<"test"<< endl;
exit(0);
}
cin.get();
return 0;
}</time.h></list></string></iostream></stdlib.h></stdio.h>
It is never late to learn
|
|
|
|
|
I never programmed with gcc in linux so I might be wrong. I am guess that new operator does not throw an exception but terminated the program when cannot allocate memory.
-Saurabh
|
|
|
|
|
how could you catch exception memory is full? is there any way in c++ for windows? not for linux, it must be same in linux
It is never late to learn
|
|
|
|
|
Well you already have the code to catch the exception...using a catch block. When new operator cannot allocate memory then it throws std::bad_alloc exception. Also the value of returned pointer is NULL.
-Saurabh
|
|
|
|
|
Thanks for reply,
I run this code under Visual c++ 2005, it does not throw any exception, it crashes computer, do u know why it crashes computer?
Thanks
It is never late to learn
|
|
|
|
|
If my calculation is correct then you are requesting about 260.74GB of memory!!! Which of course cannot be allocated. I don't think that your program should crash, instead you should get nice error from windows stating Windows is running low on memory so termination your program.
Just out of curiosity what are you trying to do?
-Saurabh
|
|
|
|