Say you get a file handle from some outside DLL and instantiate a FileStream with it. It works just fine for reading and writing.
Then you want the path and name of that handle and try to access the Name property of your FileStream object, and it returns 'unknown'.
This is true for the constructors which takes file handles:
public Fil...
Is there any way to retrieve information about how many extra displays there are besides the main one, how they are numbered, what the dimensions are, etc? I know this is pretty easy in .net land.
...
How can I programmatically retrieve the current connection type (eg. LAN or Direct connection)?
InternetGetConnectedState() isn't very reliable.
For instance, I'm connected to a wireless network, but ConTypeRet is 18, which is INTERNET_CONNECTION_LAN & INTERNET_RAS_INSTALLED. Isn't there any way to make sure that ConTypeRet is either I...
First off, this is NOT a duplicate of: http://stackoverflow.com/questions/1911053/turn-a-c-string-with-null-bytes-into-a-char-array , because the given answer doesn't work when the char *'s are Unicode.
I think the problem is that because I am trying to use UTF-8 encoded char *'s instead of ASCII char *'s, and the length of each charact...
Alright so what I am trying to do is essentially create a program that, when it is already executed, can be "executed" again, detect the already existing process and instead of creating another process, execute a function in the existing process.
Any ideas?
It's possible I am going at this all wrong. I am trying to adapt this open-sour...
I have compiled a simple win32 app successfully with bc++ (2 lines excerpt only):
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
wincl.lpfnWndProc = WindowProcedure;
Why can't I rename WindowProcedure and compile this:
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
wincl.lpfnWndProc = WndProc;
as erro...
What steps are needed to compile Version Information inside a windows DLL from the command line. I have been looking at VersionInfo files, but could not figure out how to link them to the DLL.
Thank you
...
Does anyone know how to move my SDL.net video surface around the screen programtically?
Surface videoContext = Video.SetVideoMode(1024, 768, 32, false, false, false, true, true);
var a = System.Windows.Forms.Control.FromHandle(Video.WindowHandle);
var b = System.Windows.Forms.NativeWindow.FromHandle(Video.WindowHandle);
I can't find ...
I'm writing a program in C on windows that needs to run as many threads as available cores. But I dont know how to get the number of cores. Any ideas?
...
I was under the impression that this code
#include <windows.h>
#include <stdio.h>
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
printf("WinMain\n");
return 0;
}
int main()
{
printf("main\n");
return 0;
}
would output WinMain, but of course nothing ever works how ...
I have a process in c++ in which I am using window API. I want to get the HWND of own process. Kindly guide me how can I make it possible.
...
hello i'm programming with win32api, i want that the following programm creates two process and creates an filemap. (using c++)
i don't know what i should write at Handle CreateFileMapping(...
i tried it with
PROCCESS_INFORMATION hfile.
furthermore the first parameter should be INVALID_HANDLE_VALUE, but then i don't know what to wri...
I've been playing with a DataBus-type design for a hobby project, and I ran into an issue. Back-end components need to notify the UI that something has happened. My implementation of the bus delivers the messages synchronously with respect to the sender. In other words, when you call Send(), the method blocks until all the handlers have ...
With PROCESS_MEMORY_COUNTERS_EX, I can find the peak pagefile (VM) size since the beginning of a process. Can I somehow get the peak pagefile size starting from some other point in time?
...
I've run into an interesting problem. At least in Vista, getSystemMetrics(SM_CXSCREEN) returns an incorrect value when the desktop DPI settings aren't set at 100%. For example, I tried 150% in a 1366x768 screen and getSystemMetrics() returns 911 instead of 1366 (and 1366 / 1.5 ~ 911)
According to the MSDN, getSystemMetrics(SM_CXSCREEN) ...
I am trying to write a simple program, preferably in C, that will watch a given directory. Whenever a process accesses that directory, I just want to print out the name of that process. It seems simple, but I am coming up short for solutions on MSDN. Does anyone know which library calls I will need for this, or any helpful advice? I have...
I have a situation that demands, passing the registry path as a parameter for application launch, say I have IE as default launcher for http types
HKEY_CLASSES_ROOT\http\shell\open\command\
Default = iexplore %1
Any shell launch of a URL would invoke iexplore <<"URL String">>.
My requirement is additionally pass the registry path as p...
I'm noticing a problem that has crept up a few times over the years, and seems to be happening a lot under Windows 7 in our current build.
When I test for the existence of a file, using ::GetFileAttributes(filename), I am often getting back INVALID_FILE_ATTRIBUTES, and GetLastError() is ERROR_PATH_NOT_FOUND (3).
However, the file does ...
I have a Win32 C++ program that validates user input and updates the UI with status information and options. Currently it is written like this:
void ShowError() {
SetIcon(kError);
SetMessageString("There was an error");
HideButton(kButton1);
HideButton(kButton2);
ShowButton(kButton3);
}
void ShowSuccess() {
Set...
I am wondering if someone could point me in the right direction. You know how for example, in most IDEs, if you open a source file with "open with", it runs the program and opens it up? and then if you open another one, it opens it in a new tab in the same process?
My question is NOT how to add a program to the shell commands, but rathe...