|
I think this is very Simple Question but I am new babie .
In the SDI application. I draw something on the client area. I want to save this as a BMP and some other formats(GIF, JPEG . . .). So that this image can be open in any other software.
My primary goal is to save it as BMP format.
I want to do this without using any other's library. And also without using MFC (If possible, I hope) .
Thanks in advance.
Some sample code will help alot.
|
|
|
|
|
Questions like this one are very difficult to give an answer to!
syedhassan4 wrote:
I want to do this without using any other's library. And also without using MFC (If possible, I hope) .
The answer is many many lines of code and if you want an answer I think you have to take a look at some classes or something that do what you want to do and then ask here if you'll get problems when trying to do something similarly!
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
Actually it's damn easy. Just use GetWindowDC to get a handle to the windows device context and use GDI+ to save the image.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
Picture a world without war, without hate. And I can picture us attacking that world, because they would never expect it.
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
My 'Doodle' article shows how to use GDI+ to save an image to disk in different formats, the CXImage class also on CP shows a way to do it which doesn't involve downloading the SDK or relying on a DLL. Use GetWindowDC to get a device context you can use to grab the contents of the window. Just remember to make the Image you create the same bit depth as the screen, you can use GetDeviceCaps(BITSPIXEL) on the DC you get back from GetWindowDC to figure out what you need.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
Picture a world without war, without hate. And I can picture us attacking that world, because they would never expect it.
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Hi,
Reading through the sea of documentation, I haven't been able to work this out...
I would just like to add a button to the Internet Explorer toolbar and possibly some other applications. Now what I want is that when you click this button my code should be executed (and that piece of code will probably interact with IE somehow).
Can any one point me in the right direction as to where I can find information on the topic? Or if any one is willing to share som brief info on how to go about it...?
Thx, all help is greatly appreciated,
/Tommy
|
|
|
|
|
Will implementing deskbands solve my problem?
/Tommy
|
|
|
|
|
Deskbands will allow you to add new toolbars to IE.
I suggest you also look at Browser Helper Objects too.
Michael
|
|
|
|
|
Ok, thx!
The search engine here on CodeProject seems to have gone down; are there any articles/tutorials on Browser Helper Objects that you know of?
/Tommy
|
|
|
|
|
Hi,
I'm trying to programmatically disable the hightlight that occurs
on a selected item in a CListCtrl(icon view) when focus is removed.
You know when you select an item, then set the focus elsewhere, a
selection box still appears only grayed out. It's this box I'm trying to
remove.
As an added extra, when I do want to keep the grayed box, I want to
display the full title of the file rather than chopping it as occurs
when the display text is too long.
Thanks for any help,
Wayne.
|
|
|
|
|
You should be able to do this my mapping the OnKillFocus handler for the list control in question. In that procedure, you need to de-select the item:
int sel = m_Ctrl.GetSelectionMark() ;
m_Ctrl.SetItemState(sel, 0, LVIS_SELECTED | LVIS_FOCUSED) ;
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
|
|
|
|
|
Can anybody tell me how to access a PC's serial port from a terminal server session. At the moment we access POS display units by talking directly to COM1. Is there a port name that the terminal server routes to the PC's local serial port or is there another way of doing it.
Thanks for any information you can provide.
Steve.
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
I writed regular dll in vc++ for delphi.
It works in vc client program but in delphi after the called function returned,
it performs illegal.
1.the function declared in the dll:
extern "C" _declspec(dllexport) BOOL Bin2Ots(LPCTSTR strBin,LPCTSTR strOts)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
if(strOts == NULL || strBin == NULL){
return FALSE;
}
BOOL ret;
pCO = new CCO(strOts,strBin);
ret = pCO->Bin2Ots();
delete pCO;
return ret;
}
2. code in delphi:
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TfrmConvert = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
private
{ Private declarations }
public
{ Public declarations }
end;
function Ots2Bin(csvFile,binFile:String):Bool;stdcall;external 'OTSConvertBin.dll';
var
frmConvert: TfrmConvert;
implementation
procedure TfrmConvert.Button2Click(Sender: TObject);
var
aa :boolean;
begin
aa:= Ots2Bin(edit1.Text ,edit2.Text);
end
NOTE: the last line was performed already and the unknown error occured.But WHY???
PLEASE HELP!!!
Thanks in advance!
Wangqiujie
|
|
|
|
|
Try declaring your exported function as WINAPI :
extern "C" _declspec(dllexport) BOOL WINAPI Bin2Ots(LPCTSTR strBin,LPCTSTR strOts)...
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
#define WINAPI stdcall
this would make the calling conventions compatible.
|
|
|
|
|
You need to make sure that you have compatible calling conventions for the functions.
wangqiujie wrote:
function Ots2Bin(csvFile,binFile:String):Bool;stdcall;external 'OTSConvertBin.dll';
you will need to change this declaration to specify the calling convention of this function to cdecl, because this is the default calling convention in visual c++.
(csvFile,binFile:String):Bool;cdecl;external 'OTSConvertBin.dll';
either that or you can redeclare the function in your DLL to use the stdcall calling convention:
extern "C" _declspec(dllexport) stdcall BOOL Bin2Ots(LPCTSTR strBin,LPCTSTR strOts)
|
|
|
|
|
Great!
When i changed the declaration to
function Ots2Bin(csvFile,binFile:String):Bool;cdecl;external 'OTSConvertBin.dll';
It does work!
Thanks a lot!
...
Wangqiujie
|
|
|
|
|
Though I'm no Delphi expert, I think another possible source of error is that LPCTSTR s should be mapped to PChar s in Delphi, just like this:
function Ots2Bin(csvFile,binFile:PChar):...
begin
aa:= Ots2Bin(PChar(edit1.Text) ,PChar(edit2.Text));
end
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Could anybody tell me how to subclass windows system
clock window?
I want to handle my own WM_PAINT of clock window!
when I use the SetWindowPos and MoveWindow,I can only
change the position of clock window,But I cannot change
the size of clock window,How can I change the its size?
thans in advance!
|
|
|
|
|
I am not quite sure of what you are asking. It seems like you are asking two questions.
First, have you tried GetWindowLong and SetWindowLong with the GWL_WNDPROC as the index value? This is how you subclass a window.
You may have to see what happens in the WM_GETMINMAXINFO message when the window is sized, this is where you usually restrict the size that you can set for a window.
If this is not what you are asking for please clarify your question for me.
|
|
|
|
|
Thanks for your response
First I use the SetWindowsHookEx
Then I use SetWindowLong(hwnd, GWL_WNDPROC, (LONG)WndProc) to subclass
the clock window
In WndProc I handle the message that is send to clock windows
I want to change the size(specilly width) of clock window in WndProc
when I use SetWindowPos and MoveWindow,I just can change the its position
but cannot change the size.I didn't know why.
Can you give a way out?
|
|
|
|
|
devilsword wrote:
want to change the size(specilly width) of clock window in WndProc
when I use SetWindowPos and MoveWindow,I just can change the its position
but cannot change the size.I didn't know why.
I would override the WM_WINDPOSCHANGING message.
WM_WINDOWPOSCHANGED is where a window usually cancels any size commands that are sent to it. In your handler of this message simply return 0 as the message is handled in stead of sending the message to the clocks messages handler.
|
|
|
|
|
I can change the size now
First I subclass the taskbar proc
I use the MoveWindow func.It send the WM_SIZE to clock window
Then I subclass the clock window,I get WM_SIZE in my new clock proc
I handle it in clock proc.I found that the width has changed
I will try your message,I think it will be same result.
But when I add a tray icon to tray area,the size will be restore
Can you explain it?
|
|
|
|
|
Hi,
I have a bitmap in the resources, and I would like to print it, how can I do that ? ( there are a lot of problems when I try to do that, because the bitmap is DDB).
Or... How can I add a DIB to the resources ?
Thanks, Bye !
Braulio
|
|
|
|
|
Braulio Díez wrote:
I have a bitmap in the resources, and I would like to print it, how can I do that ? ( there are a lot of problems when I try to do that, because the bitmap is DDB).
What kind of problems are you experiencing?
Actually, device independant bitmaps (DIB) are the types of bitmaps that are stored in a resource file. Device dependant bitmaps (ddb) is the type of bitmap that is selected into a device context.
Let me know what you problem is and maybe we can solve it.
|
|
|
|
|
Hi,
The problem that I have is that I want to print a bitmap ( from the resources), to do that, I have to convert to DIB, to allow print it in the printer, and then use StretchBlt to scale it, but Now I cannot manage with the coordinates to print it ( it doesn´t print anything at all).
CDC memDC;
CBitmap BmpLogo.LoadBitmap(IDB_BERTHILDA_BASELINE);
memDC.CreateCompatibleDC(NULL);
CBitmap* pOldBitmap = memDC.SelectObject(&BmpLogo);
StretchBlt(
pDC->GetSafeHdc(),
0,
0,
20000,
20000,
memDC.GetSafeHdc(),
0,
0,
35000,
38000,
SRCCOPY
);
I´m just playing with the coord numbers to see if it paints at least something...
Thanks in advance, Bye!
Braulio
|
|
|
|