|
How do I set/change an IP address on Windows NT/2000 using the Windows API by C/C++ code?
|
|
|
|
|
How can i display .bmp file on 300 DPI rather than 72dpi ( as window by
default shows images on 72dpi).
Sikander
|
|
|
|
|
What the hell are you talking about ? The d in dpi is dots, i.e. the number of pixels in your image. If you want it smaller on the screen, use StretchBlt.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
Christian Graus wrote:
What the hell are you talking about ?
Please, don't be rude when answering posts! What purpose does it serve other than that people get scared and intimidated...?
Be well,
/T
|
|
|
|
|
you can use SetWindowExt/SetViewportExt to change the effective DPI of the display.
pDC->SetMapMode(MM_ISOTROPIC);
pDC->SetWindowExt(CSize(300,300));
pDC->SetViewportExt(pDC->GetDeviceCaps(LOGPIXELSX), pDC->GetDeviceCaps(LOGPIXELSY));
..
..
pDC->SetMapMode(MM_ISOTROPIC);
pDC->SetWindowExt(CSize(72,72));
pDC->SetViewportExt(pDC->GetDeviceCaps(LOGPIXELSX), pDC->GetDeviceCaps(LOGPIXELSY));
as long as you set the Window Extent to your image's DPI, the image will be drawn at the correct size.
-c
Cheap oil. It's worth it!
|
|
|
|
|
Say wha ? How can that have any meaning at all ?
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
Christian Graus wrote:
How can that have any meaning at all ?
because each word itself has an individual meaning which is shared by speakers of the language; and together the words' meanings, joined by way of the syntax and grammar rules also shared by speakers of the language, coalesce into a thought. this is how people communicate.
-c
Cheap oil. It's worth it!
|
|
|
|
|
Yep... Saw that one coming...!
Peace!
-=- James.
"Some People Know How To Drive, Others Just Know How To Operate A Car."
[Get Check Favorites 1.4 Now!]
|
|
|
|
|
yeah, i know. i'm a snippy bastard. but i mean well !
-c
Cheap oil. It's worth it!
|
|
|
|
|
Thanks Chris.. Your answer has solved my problem very well.
sikander
Sikander
|
|
|
|
|
I try to delete the key HKEY_LOCAL_MACHINE\SOFTWARE\\mykey and the system fails showing the message: "Cannot delete \mykey. Error while deleting key.".
How could i delete it?
rechi
|
|
|
|
|
Does it contain subkeys?
If so, use SHDeleteKey() instead.
|
|
|
|
|
The problem is that i can't delete it using Registry Editor. I don't have access to the key.
rechi
|
|
|
|
|
I've had this problem before. I get around it by doing the following:
Log on as administrator.
Run regedt32 . Note, it is imporant to use regedt32 and *NOT* regedit !
Go to the offending key, and go to the Security | Permissions dialog.
You should then be able to change the permissions of the key so that it can be removed.
You can do this programmatically too in much the same way, although the Windows security API is a bear.
No generalization is 100% true.
Not even this one.
|
|
|
|
|
Maybe the double backslash is the problem here
Regards
Thomas
Sonork id: 100.10453 Thömmi
Disclaimer: Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you.
|
|
|
|
|
I'm trying to create a function which just creates a file and fills it with random bytes. I want to be able to specify the size. I do this like this...
bool CreateRandomFile(const char* pszDest, unsigned int nLen)
{
if (!nLen) return false;
static const nByteSize = sizeof(byte) * 256;
ofstream fDest(pszDest);
if (!fDest) return false;
for (int i = 0; i < nLen; i++)
fDest.put(byte(::rand() % nByteSize));
fDest.close();
return true;
} This doesn't work because when (::rand() % nByteSize) becomes 10, 2 bytes are written instead of just the one. The 2 bytes are the standard "\r\n" thing and I guess it's supposed to be this way. But what should I do to get it to work properly?
byte is typedef'ed like this:
typedef unsigned char byte; And btw.: fDest.put(10) writes 2 bytes too, and fDest.put(9) writes 1. I'm using the header "fstream" and namespace std.
Sprudling
|
|
|
|
|
Open the file in binary mode.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
does anyone know how to get the commandline of other processes (calling parameters)
|
|
|
|
|
Not sure why you would want to do this (there may be an easier way to accomplish what you're trying to do), but it would be pretty complex. Seems to me that you would have to write a hook that hooks into the application you're wondering about. Then have the hook respond to a particular event. At that point, your hook could possibly grab the __targv[n] (where n is the count of the parameter your interested in). __targv is a global variable that is accessible *only* from non-console apps. In other words, if it's not a GUI/MFC app, it's not going to work this way.
Other than that, you're on your own. Why don't you mention what you are trying to accomplish at a high level? This might make it easier to provide a reasonable solution.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
I experience a problem when migrating C++ code to .Net
I can reproduce the problem with the Wordpad sample (shipped with .NET) is built under .Net.
When text is selected in the Rich Edit control and then Copied, in can not be pasted in neither 'flat text' nor 'rich text'- format. In case Paste Special is selected only the formats "WordPad Document" and "Picture(Metafile)" are available.
When the text is pasted it seams that it is pasted as an OLE object (the "WordPad Document"- type I presume), with a kind of picture placeholder around it. And the resulting text is not editable.
I think the problem is rather in the Copying than the Pasting. CopyPaste form the standard wordpad to the sample wordpad goes fine.
The application has been built on a WinNT4.0 sp6 system, with all the updates installed necessary for .Net.
In case the so built sample application is run on a WinXP system the
behavior is the same.
Hope somebody can help, or perhaps somebody can notify me if their system can reproduce this problem:
Under .Net, Build the wordpad sample.
Try copy/pasing text in the Wordpad sample editor.
Thanks for your coop
Anne Jan Beeks
Best regards Anne Jan Beeks
|
|
|
|
|
same code 9x can but win2k cant ,why?
HINSTANCE hinstDLL=LoadLibrary("test.dll");
//start keyboard hook SetWindowsHookEx(...)
...
//end hook UnhookWindowsHookEx(...)
FreeLibrary(hinstDLL);
//win2k need Sleep(5000); why?
DeleteFile("test.dll"); //return fail in 2k
|
|
|
|
|
I'm guessing a bit here, but IIRC the 16-bit shells just reads the DLL into memory, but NT memory-maps it (which is why you can't delete the executable your process was created from in NT). I'd guess the 5-second delay is due to how the NT cache manager works, keeping the handle to the file open "just in case" until after 5 seconds timing out and purging it.
|
|
|
|
|
I have programmed a service for Windows 2000.
When starting it adds an traybar icon.
This icon is used to open a popup menu.
When installing the service I have
SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS
as service type.
Everything goes ok like this.
But then the problem:
I change the service properties LogOn from Local account to
user account (this is needed to get network access for some file
transfers).
After this change the icon doesn't show up anymore.
|
|
|
|
|
Pate wrote:
I change the service properties LogOn from Local account to user account (this is needed to get network access for some file transfers).
After this change the icon doesn't show up anymore.
That user most probably have no access whatsoever to your desktop object. I believe there was an MSDN article of how to implement RunAs using NT4 that had to deal with this problem too. Most probably it was written by Matt Pietrek.
|
|
|
|
|
What a stupid compiler VC++ 6 is !! Someone please help me for chasing bugs. I've developed a childish VC++ console application. I added a header file and a cpp file.
In header file myheader.h, i declared a class like:
class myclass
{
public:
static BOOL function(BYTE a, BYTE b)
};
In cpp file mycpp.cpp I wrote code as:
#include "myheader.h"
BOOL myclass::function(BYTE a, BYTE b)
{
/*Some Code */
return 0;
}
Now I am getting following errors while compiling:
c:\mum_client\myheader.h(6) : error C2146: syntax error : missing ';' before identifier 'Start'
c:\mum_client\myheader.h(6) : error C2061: syntax error : identifier 'BYTE'
C:\mum_client\mycpp.cpp(4) : error C2143: syntax error : missing ';' before 'tag::id'
C:\mum_client\mycpp.cpp(4) : error C2501: 'BOOL' : missing storage-class or type specifiers
C:\mum_client\mycpp.cpp(4) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
mum_net_io.obj - 5 error(s), 0 warning(s)
Someone please tell me what reason these bugs get generated.
|
|
|
|