|
Hello, i have a small problem with saving a bitmap to file.
Well, in WM_PAINT case i have implemented a code that receives a bitmap from clipboard
adds a text there and.. yep and i dont know how to save it into a file.
Please help me with it, i am searching it for 2 weeks and havent found explanation of that problem.
Ohh im not MFC programmer. Pure API.
Regards.
|
|
|
|
|
if you are getting a DIB from the clipboard, all you have to do is fill-in and write a BITMAPFILEHEADER struct, followed immediately by your DIB.
if you're getting an HBITMAP from the clipboard, you'll get to get a DIB from it then follow the steps above. use GetDIBits.
-c
Alcohol is the anesthesia by which we endure the operation of life.
-- George Bernard Shaw
|
|
|
|
|
So there isnt any function that makes it automatically?
I mean something like savetobmp(...)?
Could you please, help me to solve this problem?
|
|
|
|
|
no, there is no such function.
the process i described can be done in less than 10 lines of code, if you have the DIB. it is entirely trivial.
-c
Alcohol is the anesthesia by which we endure the operation of life.
-- George Bernard Shaw
|
|
|
|
|
Yes, but as you said "if i have the DIB". The operation i am doing is:
OpenClipboard(hwnd);
hBitmap = (HBITMAP)GetClipboardData(CF_BITMAP);
Please, help me to write those "10 lines of code".
|
|
|
|
|
|
Big thanks, you really helped me.
|
|
|
|
|
I found problem on my application developed on Visual C++ 4.0. When our client run the application, we found the Dr.Watson crash dialog. Since we cannot reproduce the problem, we have to create PDB or DBG file to place on the client's machine to track the failed module. But we faced the problem in creating PDB or DBG file. As we sent the PDB file to the client's machine and wait for the crash, we find only 'No symbol' shown in the Dr.Watson log file. I think it may cause from incorrect build PDB file or configuration. Does anyone know to use PDB to track this kind of problem?
Another way about DBG file, we also don't know how to create DBG file. Does anyone have any suggestions on this issue?
|
|
|
|
|
Hi,
I would like to know if it is possible to load a .gif image into a button?
The idea is to make the button image flash.
Let say the button must change from green to grey and back again continuously.
Thanks
Regards
Rui
|
|
|
|
|
Ruca wrote:
I would like to know if it is possible to load a .gif image into a button?
there is no built-in support for that. you might be able to find a control here.
-c
Alcohol is the anesthesia by which we endure the operation of life.
-- George Bernard Shaw
|
|
|
|
|
Ok, after a long search on the internet I finally stumbled across the packet filtering API built into Win2k and up. Unfortunately this is extremely badly documented.
I would greatly appreciate anyone that can give me a simple example containing the PfCreateInterface function or anything along those lines. When I do a call to PfCreateInterface all I get is a 'Overlapping I/O in progress' error.
Any help at all will be more than appreciated.
Thanks
Shiver
|
|
|
|
|
is it possible to format a string so that it displays multiple lines in the tooltip? I'm using CButtonST and don't really understand why escape sequences don't work.
Thanks!
|
|
|
|
|
Hi everybody,
I have a button on the status bar. The following code is included in mainframe::oncreate function:
CButton * button = new CButton;
button->Create(_T("SMS"), WS_CHILD | WS_VISIBLE | BS_FLAT | BS_BITMAP, CRect(0, 0, 0, 0), &m_wndStatusBar, IDC_BUTTON_STATUS_BAR);
button->SetBitmap( ::LoadBitmap( NULL, MAKEINTRESOURCE(IDB_BITMAP5) ) );
I want to place a BItmap in the button, as can be seen. But the above code does not work. The button simply appears empty.
button->SetIcon(::LoadIcon(NULL, MAKEINTRESOURCE( IDI_ICON1 )) );
An attempt at loading an icon does not work either. (with the BS_ICON set).
Can anyone help?
Thanks
Rui
|
|
|
|
|
I guess the problem lies in the CRect(0, 0, 0, 0) part.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi Joaquín,
thanks for the try, but the following works:
CButton * button = new CButton;
button->Create(_T("SMS"), WS_CHILD | WS_VISIBLE | BS_FLAT | BS_ICON, CRect(0, 0, 0, 0), &m_wndStatusBar, IDC_BUTTON_STATUS_BAR);
button->SetIcon( AfxGetApp()->LoadIcon( IDI_ICON1 ) );
I cannot understand why, this works and not the previous code. Why must I use AfxGetApp to LoadIcon() and not just LoadIcon()?
Any answers?
Rui
|
|
|
|
|
Because you need an instance handle in order to find and load the icon. The NULL value you supplied as the first parameter to ::LoadIcon and ::LoadBitmap was insufficient.
|
|
|
|
|
Thanks for the explanation.
How do I get the hinst?
Cheers
Rui
|
|
|
|
|
OK, I understand that, what is bothering me is, after reading the MSDN documentation, I don't understand how to get the "Handle to an instance of the module whose executable file contains the icon to be loaded"?
Thanks for your time and excuse my ignorance.
Cheers
Rui
|
|
|
|
|
The hInstance parameter is passed by Windows to WinMain when an application is started. Use AfxGetInstanceHandle() to get it. If that does not answer you, I don't understand your question. Try rephrasing it and posting again and perhaps someone can help.
|
|
|
|
|
CComVariant var("Somevalue");
How to convert this to C-style string
|
|
|
|
|
|
Hi
Iam using the GridCtrl in my code.The Grid is allowing to enter infinite number of charecters in the cells.I want to restrict the cell characters by some 12 or 13.That is user should not enter more than 12 charecters in a cell.
Please help me.
munafmohamed
|
|
|
|
|
This is from memory, so you'll have to check on the implementation details.
When a cell is being edited, it created an "InPlaceEdit" control. This is an
edit box which is subclassed to capture the WM_KILLFOCUS message.
When this is created, the grid control sends you a notification. You can get
the handle / CWnd * of the edit box and send it a EM_LIMITTEXT message.
I hope this helps,
Iain.
|
|
|
|
|
I'm currently trying to use the Scintilla (www.scintilla.org[^]) control in one of our applications. That's rather simple and works.
Problem is that I want to add a colorizer (for our macro language) to Scintilla. It seems like I have to write my own lexer module specifically for Scintilla, which is a pitty since I already have a lexical analyser written in lex/flex, that works together with our parser, written in yacc/bison.
I would like to reuse our lex/flex lexical analyser in the Scintilla lexer.
Anybody done that already ? Or anyone ideas ?
Thanks.
Enjoy life, this is not a rehearsal !!!
|
|
|
|
|
Is this possible...?
Spy++ has a neat feature where you drag the bullseye over a window and it returns it's info like class info and process ID and thread and such...
I assume I can get the process ID using GetWindowThreadProcessID() , but once I have a window or application process how can I get the module's ICON...???
Thanx in advance!
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|