|
thank you.
I had tested the API before. This will only return the DPI used by windows to display the font for example the menu fonts, shortcuts and etc. There are ony 120 or 96 as options.
My intention is to get the DPI use by the window to display all the items in the windows. All the elements on the screen.
For instance. This is extracted from www.shortcourses.com
Monitor size
Resolution 14" 15"
640x480 60 DPI 57 DPI
800x600 74 DPI 71 DPI
1024x768 95 DPI 91 DPI
Anyway, suppose I am able to get the resolution. How should I get the monitor size by API?
thanks
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Sorry, I don't know how to get the monitor size via API. I am not sure if you can do this. Did you try to use the options HORZSIZE/VERTSIZE of GetDeviceCaps?
There is an article in MSDN which describes how to write high-DPI applications. You may find some information in this article which are useful for you.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dngdi/html/highdpiapp.asp
How to Write High-DPI Applications
Nick Kramer
Microsoft Corporation
March 2001
|
|
|
|
|
thank you
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Hi,
Does any one of you experts know how to compress the windows registry programmatically ?
ANy links would also be helpful
balu
|
|
|
|
|
Why would you want/need the registry compressed? As often as it's accessed, you'd likely suffer a performance hit.
|
|
|
|
|
do u mean "compress" or clear deleted keys to make it smaller?
Don't try it, just do it!
|
|
|
|
|
I meant to remove the empty space, to make it smaller.
The empty space is created by the deletion of keys.
Hari Krishnan
|
|
|
|
|
Hello,
can one rely on the API function IsBadReadPtr? I mean, can we use it in our programs in release mode?
Background: I am programming a tool that detects SMBIOS. SMBIOS is normally mapped to address 0x000F0000. Under Win95/Win98 this is easily accessible, but under WinNT I need to check if I have permission to read from this address.
Now I wonder if I can use the function IsBadReadPtr for this.
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Dominik Reichl wrote:
I mean, can we use it in our programs in release mode?
Yes, I use it all the time.
- Anders
Money talks, but all mine ever says is "Goodbye!"
http://SourceLocker.net[^] SourceControl and DefectTracker Project.
nsms@spyf.dk <- Spam Collecting
|
|
|
|
|
Or would you use VirtualQueryEx?
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
IsBadReadPtr() have always been enough for me.
From MSDN:
The IsBadReadPtr function verifies that the calling process has read access to the specified range of memory.
That sounds exactly like what you want, right?
- Anders
Money talks, but all mine ever says is "Goodbye!"
http://SourceLocker.net[^] SourceControl and DefectTracker Project.
nsms@spyf.dk <- Spam Collecting
|
|
|
|
|
Anders Molin wrote:
That sounds exactly like what you want, right?
Yep, I just wasn't sure if that function has only been designed for debug mode. But if you say it works well in release mode, I use this function
Thanks
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
It looks like a very simple question, but I stuck with it !
I have the selfwritten ATL ActiveX. Then I wanted to place it inside the MFC window such as CMDIChildWnd to fill the entire client area. The only thing I want is that my ActiveX can get focus when the hosting window is activated. So I put the following code:
void CMyFrame::OnSetFocus(CWnd* pOldWnd) {
if (m_pView!=NULL)
m_pView->SetFocus();
else
CMDIChildWnd::OnSetFocus(pOldWnd);
}
where the CMyFrame is frame derived from CMDIChildWnd,
m_pView - my ActiveX pointer. It has a type of pointer to the ActiveX CWnd_wrapper created by the VC7 wizard "MFC Class from ActiveX control".
The problem is that my control gets focus only once - the first time the hosting window is activated.
I've tested my ActiveX in the simple dialog window - all is ok...
The ActiveX is created as:
int CMyFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
m_pView = new CMyControl;
if (m_pView!=NULL) {
CRect rect(0,0,0,0);
m_pView->Create(NULL,WS_CHILD | WS_VISIBLE | WS_TABSTOP,rect,this,1); // "this" - is a parent CMDIChildWnd
...
Does anybody has an idea ?
Thank you very much
P.S.
Actually I know the reason of that
I separated my message in two parts:
If I do something completly wrong, then you will see it from the first part - please tell me if its so
Now the details:
m_pView->SetFocus() actually does the DoVerb(OLEIVERB_UIACTIVATE) i.e. activates my ActiveX UI.
This is done internally by the COleControlSite::SetFocus.
The problem is that default implementation of COleControlSite ignores OnFocus(FALSE) event that comes from my ActiveX when it loses the focus. COleControlSite does not call UIDeactivate upon this event.
Since my control was once OLEIVERB_UIACTIVATEed and was not UIDeactivated it ignored the next DoVerb(OLEIVERB_UIACTIVATE) though it losts the focus (the ATL implementation).
I cannot modify this code since its in the ATL & MFC...
|
|
|
|
|
hello friends,
i just wanted to know How can i show The treectrl of a BrowseDlgBox with checkBox.
I mean i wanted to show the CheckBox when with the treectrl that is shown in an Browse Dlgbox this is a Folder Browse
If anyone can help !!!!!
I am working in MFC
Thanx
TAKE CARE
|
|
|
|
|
I draw WindowLess ActiveX beyond the rectangle provided by container,
so at redraw renews only part that is only within rectangule
provided by container,
how to make redrawn full area?
By SetClipRegion() ?
Or else?
How to make it possible to react to mouse at draw place?
Or
there is a simple method to move Windowless control from
it self ? (Best way may be due to resolves all above, I think)
Thanks you?
|
|
|
|
|
Hi!
I have a SDI application and I want it to be maximized when it starts... How can I do it?
Well... I am a beginner ...
|
|
|
|
|
Easy answer; somewhere along the line you're using ShowWindow to get the window displayed. Check out what arguments it takes; you're probably passing in a default one from MFC. You could pass in a different SW_ value...
Steve S
|
|
|
|
|
Thanks a lot. I was trying to do it with cs.style because I was disabling system menus from there but it wouldnt work!
Well... I am a beginner ...
|
|
|
|
|
Hello,
I don't know where you altered the CREATESTRUCT, but you should do it in the PreCreateWindow() function !
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Hi!
I am making a program which will cut a file into several pieces. Using fstream.h functions I am reading a file byte by byte and writing it into another file ( in the size I want ). The problem is that I don't know how to automatically generate necessary files. Lets say my file to cut is 10000bytes. Ad I want to cut it into 10byte pieces, I will have to generate 1000 files but I don't know how to generate 1000files! The code i use is this:
------------------
LPCTSTR file1 = "data/filein.bin";
LPCTSTR fileoutf1 = "data/fileout1.bin";
LPCTSTR fileoutf2 = "data/fileout2.bin";
char * buffer;
int i= 0;
long l,m;
long bigness;
long requiredf = 0;
ifstream filecount(file1, ios::in|ios::binary);
l = filecount.tellg();
filecount.seekg(0, ios::end);
m = filecount.tellg();
filecount.close();
bigness = m - l;
requiredf = bigness / targetbytes + 1;
ifstream filein(file1, ios::in|ios::binary);
ofstream fileout1(fileoutf1, ios::out|ios::binary);
ofstream fileout2(fileoutf2, ios::out|ios::binary);
buffer = new char[1];
do{
filein.read(buffer, 1);
fileout1.write(buffer, 1);
i++;
}while(i
|
|
|
|
|
char szFilename[MAX_PATH];
int max_number_of_files;
max_number_of_files = size_of_file / 10000;
if ((size_of_file % 10000) != 0)
max_number_of_files++;
for (int x = 1; x <= max_number_of_files; x++)
{
sprintf(szFilename, "outfile%d", x);
}
|
|
|
|
|
I have a long time operation. In order to be able to interrupt it, the operation runs in different shorter steps. After each step I get a callback message where I can return if I want to continue the operation or not. Since the user should be able to abort the operation I developed a modless dialog box with a cancel button. The dialog class has 2 methods: one is the event handler for the cancel button (I set an internal flag if the user clicks on the button) and the other is a query method which I call in my callback handler which I mentioned above.
The query method which I call regularly contains the following code
<br />
MSG msg;<br />
while (::PeekMessage(&msg, NULL, <br />
NULL, NULL, PM_NOREMOVE))<br />
{<br />
AfxGetThread()->PumpMessage();<br />
}<br />
return m_bAbortedByUser;<br />
My problem is, that I can not click on the cancel button in my dialog. But the weird thing is that I can cancel the operation by closing the dialog using the X button of the dialog.
So why does the dialog gets the closing message via the X button but not the click message on the button? Anyone an idea how I can fix it?
Thanks in advance.
|
|
|
|
|
i think u should see split/merge files project by Bijesh as your lead of clue.
the project use CWinThread as working process and there is a good example how to interact to that working process from your main window. you can start and you also cancel the operation too nicely there.
the project you could find it codeproject, i forgat the link, but u could always search it
((
_; )
((
|
|
|
|
|
Thank you for the answer. But I think that my problem is not the interaction. And cancel the operation seems to generally work with my code (if you press the X button of the dialog). But my main problem is that although I keep the windows message loop running in my query method I don't get the OnCancel message from windows if I click on the cancel button. So I primary want to know why the messages are handled differently (has the X button message a higher priority?).
|
|
|
|
|
Put the "long time operation" code in another thread. This will allow the primary thread to respond to user events (e.g., clicking the Cancel button). Anything else is going to be kludgy at best.
|
|
|
|