|
i am trying like this but this give reference error please reply ASAP
CBitmap *bitmap1=(CBitmap *)GetDlgItem(IDC_STATIC1);
bitmap1->LoadBitmap(IDB_BITMAP1);
Bankey Khandelwal
Software Engineer
|
|
|
|
|
Bankey Khandelwal wrote: CBitmap *bitmap1=(CBitmap *)GetDlgItem(IDC_STATIC1);
bitmap1->LoadBitmap(IDB_BITMAP1);
GetDlgItem(...) returns a CWnd* . You are trying to cast it to a bitmap. This is wrong.
You should do it like this...
CBitmap bmp;
bmp.LoadBitmap(IDB_BITMAP1);
CStatic *pStatic = (CStatic*)GetDlgItem(IDC_STATIC1);
pStatic->SetBitmap(bmp);
Nibu thomas
Software Developer
|
|
|
|
|
thanks you,
it is loading but not show on button where is i wrong please reply
Bankey Khandelwal
Software Engineer
|
|
|
|
|
Bankey Khandelwal wrote: not show on button
Is it a button! or Is it a Static!
Nibu thomas
Software Developer
|
|
|
|
|
it is static
Bankey Khandelwal
Software Engineer
|
|
|
|
|
Your static control must have the style SS_BITMAP (for bitmap) or SS_ICON (for icon).
Nibu thomas
Software Developer
|
|
|
|
|
ya there is type bitmap but there is no style property like bitmap etc.
Bankey Khandelwal
Software Engineer
|
|
|
|
|
Bankey Khandelwal wrote: ya there is type bitmap
Yes that is the one.
Nibu thomas
Software Developer
|
|
|
|
|
You said it is loading but not show on button,the reason is u have to check the button properites as ownerdraw.
It works now
Kiranmaye
|
|
|
|
|
U can directly load on picture control by changing the control properties
Right click on picture control and change type to bitmap and select bitmap id in Image.
|
|
|
|
|
Set the type of button as bitmap and perform the following :
(here m_bit is an object of CBitmap , m_btnStart is the variable for CBitmapButton)
m_bit1.LoadBitmap(IDB_BMPSTART);
HBITMAP hBit1 = (HBITMAP) m_bit1.GetSafeHandle();
m_btnStart.SetBitmap(hBit1);
// Use m_btnStart.SizeToContent() if you want to set the size of the button to that of the image being displayed on it
(open the resource editor and copy the .gif image to the bitmap image in the resource editor)
*******and yes on the picture control you have to set the type as bitmap and pass the image name of the bitmap in the IMAGE option of resource editor
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
-- modified at 5:31 Thursday 2nd March, 2006
|
|
|
|
|
Hello everyone. I would like to know how to launch an application (.exe) when clicking a button on an MFC dialog. Thanks in advance
Aman
|
|
|
|
|
|
Use ShellExecute()
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
Hi,
use ShellExecute()
Bye,
Cool Ju
Dream Ur Destiny
|
|
|
|
|
hello members
please help me how to use the runreportwizard method in VC++ 6.0 using crystal reports 11. i have developed a simple mfc which can design, preview, open and save reports. but now i want to add the reportwizard. please help me out.
|
|
|
|
|
Friends ! I need help !
I have to write a programme in Visual C++ 6 which can listen or sniff the serial port, but without opening the port. The sniffer and the programme which communicates through the serial port has to be on the same PC, I have to write a program which can read ( or listen ) the data that goes out and comes in from the serial port, BUT NOT TO OPEN THE PORT, to let communication programmes communicate through serial ports.
If anyone has an idea how to write this sniffer programme, please send me a advise.
Many thanks !
Szilard
SZ
|
|
|
|
|
You cannot do that (or from what I know you cannot do). When I need to do such a thing, I make a 'harware' sniffer . That is, I connect another connector on the wire so I can plug it into another serial port (if you have two on your computer) and I can sniff the data on the port.
Hope this helps
|
|
|
|
|
Thank you for your reply Cedric .
I don't know if you have heard about the HHD Free Serial Port Monitor. That would be a good model for the programme I have to write. I don't know what tehnique they use. This HHD software monitors in a passive mode al the communication done by other software through the serial port, I don't think it opens the port otherwise it could block the communication for other software.
I also have another question, what if I use assembler code, embedded C or something like that, and integrate in my visual C++ code?
I think there has to be a possibility to read the memory location through which the serial communication is done.
Thanks in advance !
Szilard
Szilard
|
|
|
|
|
|
Thank you James your advise was very usefull.
-- modified at 5:22 Thursday 2nd March, 2006
|
|
|
|
|
I recommend looking up "API Hooks." You might be able to set hooks on the API calls used to perform serial communication.
That's where I would start.
|
|
|
|
|
Could somebody please help me out with where to start when coding a multithreaded application in a NON MFC project.
My aim is hopefully quite clear. Lets say I have created a class which upon initialization will do some extensive file parsing, a process which could take a good deal more than 10 seconds. Obviously I don't want my application to freeze and wait for this to complete. I think the best thing to do is inisialize the class under a seperate thread and periodically check as to whether it has finished or not, while at the same time displaying to the user some sort of progress bar.
Problem is I have never before coded any form of Multithreaded app before, and there is very little information to be found about doing such a thing.
|
|
|
|
|
use API CreateThread
nave
|
|
|
|
|
In most cases calling CreateThread is a bad idea - In fact it is probably the first and most common error programmers make when writing a multithreaded program. You should use _beginthread or _beginthreadex - or AfxBeginThread in an MFC application. If you don't call these functions certain structures are not initialized for the thread. For example floating point math may not work and calling CRT functions may not work. The moral of the story is that you shouldn't use CreateThread unless the thread calls only win32 functions, doesn't use floating point and also doesn't call CRT functions.
Steve
|
|
|
|