|
Hi Andrzej,
If you have got the problem with my code. I am waiting for your responce.
SORRY 4 DISTRUBING U Much
Sujan
|
|
|
|
|
Does this article help?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Yes Yes
Thanx David. Now i am working with it.
Sujan
|
|
|
|
|
Ok this has to be obvious, but somehow I must be missing something somewhere...
I made a dialog and on it I placed a static control with a bitmap on it (in the resource editor). All well, but when I want to change the bitmap displayed on the control, the control vanishes(does not get redrawn)...
I tried to create a CStatic control on the stack, but that one never shows... What`s wrong with this code?
This is placed in the OnInitDialog of the dialog:
m_statTest.Create(_T(""), WS_CHILD|WS_VISIBLE|SS_BITMAP|SS_CENTERIMAGE, tmprect,this);
m_statTest.SetBitmap( ::LoadBitmap(NULL, MAKEINTRESOURCE(IDB_MYBITMAP)));
The m_statTest control is never displayed ( and yes, the tmprect is inside the CDialog frame)...
Another CStatic control that I created with the classwizard from a CStatic on the Dialog resource, also disapears when I call the SetBitmap on it...
My bitmap has 256 colors, might that be the prob??? (although it does display correct when I never use the setbimap on the control added in the resource editor)
Any help is greatly appreciated...
Davy
|
|
|
|
|
Use the following code
On the cpp file add the following.
CRect tmprect(100,100,300,300);
m_statTest.Create(_T(""), WS_CHILD|WS_VISIBLE|SS_BITMAP|SS_CENTERIMAGE, tmprect,this);
bm.LoadBitmap(IDB_BITMAP);
HBITMAP hBitmap = (HBITMAP)bm.GetSafeHandle();
m_statTest.SetBitmap(hBitmap);
on the header file create the instance of bm as
CBitmap bm;
This will work
|
|
|
|
|
To make your code working change the first parameter in function ::LoadBitmap from NULL to AfxGetApp()->m_hInstance .
|
|
|
|
|
Thanks Sujan and Andrzej. Both solutions seem to work..
Seems to me that the MSDN library which explains the SetBitmap function of the CStatic control should be updated...
I got that specific codepart for the control created on the stack from the MSDN lib.
Ah another thing, when using the code part:
m_statCtrl.SetBitmap(::LoadBitmap(....)); //m_statCtrl is CStatic control
don^t you loose memory? I mean the documentation on LoadBitmap says that one should call DeleteObject on handles created by LoadBitmap... On the other hand, MSDN suggests this code-snippet to set the bitmap on a CStatic... I don^t think the CStatic deletes the handle when it gets destroyed or changed, or does it?????
(another thing that should be updated in MSDN perhaps?)
Greetz,
Davy
|
|
|
|
|
You will not have memory leaks because the system automatically deletes handles when the process that created them terminates.
|
|
|
|
|
How to get out the progress status in DirectShow when I encode a media file for example ?
|
|
|
|
|
I need to be able to mointor accessed files accessed on windows like sysintenal file mointor how I can do this.
|
|
|
|
|
you can try using The FindFirstChangeNotification(easier) or SHChangeNotify function.
|
|
|
|
|
Hi All,
Can some one tell me the differences between semaphores,critical section and mutexes.When should they be used(i know these are used for synchronization between threads) and the advantages/disadvantages of them over the other.
Thanks in advance
Regards
Raghu
|
|
|
|
|
in one sentence.
Semaphore can be used to manage resources, criticalsection to synchronize access to shared data within same(single) process and mutex to synchronize access to shared data among different process also.
There is no spoon.
mail
|
|
|
|
|
Hello Friends,
I got a problem.
I had splitted the actual view into 4 parts. every view is been derived from different view's class.
The main problem is the one splitter window which has been derived from the FormView has got 2 edit boxes which will resizing itself based upon the size of the window. and when I click in someother view some message has to be displayed in these edit boxes. for example when I click in View1 then some message which I pass from View1 has to be displayed in the edit boxes present in the View2.
I am trying but its always giving me assertion failed and when I debug it its giving the asserting failed in the SetWindowText message. I had created 2 different variables of type CEdit.
Neelesh K J Jain.
I am getting the assertion failed in the winocc.cpp at line 229, When I am using the SetWindowText
Neelesh K J Jain.
|
|
|
|
|
Get the view address using GetActivePane() function and use it for setting the window text using setwindow text function
eg.
CMyView *pView = (CMyView *) mysplitter.GetActivePane();
pView->SetWindowText("Hi");
|
|
|
|
|
Its giving me a problem at the SetWindowText message in the Winocc.cpp file.
|
|
|
|
|
Check the view's pointer's value @ debug mode. Also you can use the GetPane to get the view's pointer. Have a look @ msdn.
|
|
|
|
|
Hi Sujan,
Can you please explain with code please.
|
|
|
|
|
Hi Sujan,
Can you please explain with code please.
Neelesh K J Jain.
|
|
|
|
|
Hi Jain
I am @ the office, i'll surely do it when i reach home.
Sujan
|
|
|
|
|
Hi Jain
Here i do consider that i am having two panes ie two views, first the CCallManagerView(0,0) and the other CUserView(1,0). So when i do need to set some value to the CCallManagerView's control from CUserView, i'll be using the following code
void CUserView::SetValue2Manager(void)
{
CMainFrame *pMainFrame = (CMainFrame *) GetParentFrame();
CCallManagerView *pView = (CCallManagerView *)pMainFrame->m_wndSplitter.GetPane(0,0);
if (pView)
{
pView->myEdit.SetWindowText("Hai From Call Manager");
}
}
Hope this may help you. If you want the CUserView then use GetPane(1,0)
Sujan
|
|
|
|
|
It looks like microsoft stopped providing the DDK for download. Does anyone know where else this can be obtained?
Thanks,
Jill
|
|
|
|
|
|
Good Day
I have a device that upon plug into USB, loads the driver USBAudio.sys. I wish to develop a GUI for my device.
How can i go about doing it? Is there any info about the USBAudio.sys which i can reference?
Is there anyway which my GUI can directly interface with the USBAudio driver to pass data from GUI to USB to my device?
Thanks!
|
|
|
|
|
I want to open a pipe to the usb port and write some data. Can someone point me in the right direction?
Thanks,
Jill
|
|
|
|