|
Stephen Hewitt wrote: You should
Yes I know. I plan to do that when I have a little more spare time (which I don't know when )
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
hi
how to hide/show a button from dialog in Win32 Application.
Manjunath S
GESL
Bangalore
|
|
|
|
|
|
Try:
MyButton.ShowWindow(SW_HIDE);
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
hide:
ShowWindow(GetDlgItem(hWndDlg, ButtonID), SW_HIDE);
show:
ShowWindow(GetDlgItem(hWndDlg, ButtonID), SW_SHOW);
|
|
|
|
|
HI,
My applicaion is using CPU value 99 in task manager, that makes makes the machine slow,
How can i reduce the cpu usage , or how can i detect which part is gettting more cpu.
Thanks
Regards.Hi,
|
|
|
|
|
If you don't provide more info, we won't be able to help. It's not by reposting the same question twice without more details that you will get an answer.
First, try to locate where to problem comes from. What are you doing continuously that take so much time ? Once you located that, you can still put some sleep in it to free some CPU time (not very elegant but works).
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Can you be more specific
whitesky
|
|
|
|
|
Most likely cause is a for or while loop that does not end because there is a bad value of a variable or wrong assumption in the code somewhere
cheers,
Neil
|
|
|
|
|
Hi,
I am writing a DLL that links dynamically to MFC. I am having a serious problem with threads; when I create a thread using AfxBeginThread, the thread process fails.
After examining with the debugger, it seems that the data I pass to the thread (a void*, which in my case is a pointer to a CObject* derived class) is being corrupted; calling ASSERT_KINDOF on the object fails (the actual failure is that internally the object cannot call GetRuntimeClass) and skipping ASSERT_KINDOF and simply calling a function of the class fails.
It seems the object's virtual function table is being problematic. At the beginning of every possible relevant function I have used AFX_MANAGE_STATE(AfxGetStaticModuleState()); to see if this helps. It doesn't.
Is there an in-built limitation to threading like this in DLLs? BTW this is not an MFC extension DLL, just a dll that dynamically links to MFC.
I have a big deadline approaching and any help would be enormously appreciated!
Thanks in advance!
Dave Kerr
|
|
|
|
|
|
CreateThread gives exactly the same problem. I am convinced it is a memory issue. The first part of the thread process is:
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
// Cast the data.
CThreadFunction* pFunction = reinterpret_cast<cthreadfunction*>(pData);
// Assert it is the correct type.
ASSERT_KINDOF(CThreadFunction, pFunction);
// Do the work.
UINT uError = pFunction->DoFunction();
...
However when I examine pFunction in the memory window, the memory looks to be " .Anywhere.dll _AFX_MANAGE_STATE.." so the pointer is definately not pointing to the correct address.
Any ideas?
Dave Kerr
codechamber@hotmail.com
http://www.codechamber.com
|
|
|
|
|
hi all
plz tell me how can i place a picture
(image ) on buton control in
mfc dialog bsed application
plz send some example
Ashish Dogra
MCA
Noida
|
|
|
|
|
|
TO put an image on the button instead of making the variable of CButton type create it as CBitmapButton and use LoadBitmap to set the image on the button.;
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
like this
CButton m_BitmapButton;
m_BitmapButton.Create("Test",BS_BITMAP|WS_CHILD|WS_VISIBLE,CRect(0,40,150,63),this,1);
m_BitmapButton.SetBitmap((HBITMAP)LoadImage(NULL,"c:\\0.bmp",IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_CREATEDIBSECTION));
whitesky
|
|
|
|
|
ok sir but i declare this code in OnInitDialog() function
now it does not show any picture
and plz tell me my picture is .jpg so plz tellme where this code is declared
and how to show that picture
plz...............sir
Please mail me
|
|
|
|
|
I am afraid the LoadImage function from the pervious sample cannot work with JPEG file and accept BMP files only. Therefore you should check the code using some BMP file.
If it works, you have to convert your image to BMP format. For this purpose I think you can use Save As command of the Paint system accessory. Or see if Visual Studio can be used for this.
|
|
|
|
|
one way <CImage class>
whitesky
|
|
|
|
|
You dont need to create i created for this that i show this code
if you have one button set bitmap in property form button in property window or use
m_Button.ModifyStyle(0,BS_BITMAP);
(Jpg)->not problem use CImage class
and see
<br />
m_BitmapButton.Create(_T("Test"),BS_BITMAP|WS_CHILD|WS_VISIBLE,CRect(0,40,150,63),this,1);<br />
CImage m_Image;<br />
m_Image.Load(_T("e:\\0.jpg"));<br />
m_BitmapButton.SetBitmap(m_Image.Detach());<br />
//include AtlImage.h
whitesky
|
|
|
|
|
See here.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Are you trying to browse for a file?
for that purpose use CFileDialog
CFileDialog d(true);
d.DoModal();
CString strPath = d.GetPathName();
SaRath.
"It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
no, what i want is i have filename and i want the path of the file name.
so that i can use this path .
ram
|
|
|
|
|
What problem are you facing using the GetFullPathName() as I suggest in my post?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|