|
I want the window I click in to be topmost.
Using CWnd::GetDesktopWindow(), as Joaquín wrote in his post, works fine.
Passing the this pointer to CDialog::Create() makes the dialog be always topmost.
Cheers,
/Fredrik
Sonork ID: 100.11430:PhatBoy
|
|
|
|
|
Hello everybody!
Help me in follo...
How I can runtime change values of margins of page to force to print from the edge of page?
Best regards,
Eugene Pustovoyt
Sonork ID 100.10002:Yaumen
|
|
|
|
|
When you OnPrint handler is called, the printable area of the page is in the CPrintInfo objects member var m_rectDraw. Your OnPrint should use the values in this to decide wher to print on the page. To give yourself margins, setup a dialog that lets you enter the margin values, and then configure m_rectDraw at the start of the OnPrint procedure to take the margins into account:
int xl = (int)(pDC->GetDeviceCaps(LOGPIXELSX) * g_LeftMargin) ;
int xr = (int)(pDC->GetDeviceCaps(LOGPIXELSX) * g_RightMargin) ;
int yt = (int)(pDC->GetDeviceCaps(LOGPIXELSY) * g_TopMargin) ;
int yb = (int)(pDC->GetDeviceCaps(LOGPIXELSY) * g_BottomMargin) ;
pInfo->m_rectDraw.left += xl ;
pInfo->m_rectDraw.right -= xr ;
pInfo->m_rectDraw.top += yt ;
pInfo->m_rectDraw.bottom -= yb ;
HTH
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
|
|
|
|
|
The given method reduces m_rectDraw ! And whether probably will increase m_rectDraw so to clean margins absolutely?
Best regards,
Eugene Pustovoyt
Sonork ID 100.10002:Yaumen
|
|
|
|
|
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.
|
|
|
|