winapi

Getting working directory on OpenFileDialog

When you select a number of files on OpenFileDialog you get the working directory path in a structure member of OPENFILENAME but when you select a single file you get the path to filename in that variable member. Would there be a possible way to get the path first before looping and counting to check the number of files? ...

Silent Print with Internet Explorer

I have a desktop application that needs to print HTML files. I can launch Internet Explorer with the printto verb from Shell Execute and it will print the file, the problem is it always displays the print settings dialog box. Is there any way to get it to print without the dialog? ...

How can I make socket access behave 'asynchronously' without requiring a message loop?

My program uses a NetworkOutput object which can be used to write data to a remote server. The semantic is that in case the object is currently connected (because there is a remote server), then the data is actually sent over the socket. Otherwise, it's silently discarded. Some code sketch: class NetworkOutput { public: /* Constructs ...

How to make tabs work with win32? I'm not using a dialog

I've created my controls in my window in the WM_CREATE message like this: case WM_CREATE: { CreateWindowA("button", "Refresh Listview", BS_MULTILINE | WS_CHILD | WS_VISIBLE, 10, 10, 70, 50, hwnd, (HMENU)IDC_REFRESHLW, g_hInst, NULL); break; } When I press tab it does nothing, do i have to in...

When an MFC dialog is hidden after DoModal, are its controls destroyed?

I've used MFC dialogs before where you do: EnterNameDlg dlg; dlg.DoModal(); string str = dlg.GetName(); However a dialog I have now actually looks at a list-box control in such a method and it's not working. Although the class instance clearly exists after DoModal(), does the actual dialog get destroyed? I noticed calling DoModal() a ...

Change session and keyboard language programmatically on Windows

It it possible to change the session language and keyboard language programmatically for current user via Windows API after the user has logged on? Changing some registry settings and logging off/rebooting is not a solution for me. I know that ActivateKeyboardLayout can be used to adjust keyboard but only works for the calling process. ...

Why i should call Control.Invoke from non-ui thread?

Why i should call Control.Invoke from non-ui thread? As i know any manipulations with control are the messages to control. So when i call, for example TextBox.Text = "text", it will produce message SendMessage(TextBox.Hanlde...). That message will be queued into UI thread message queue and dispatched by UI thread. Why i have to call invo...

c++ win32: how to set back color of a window?

I can set the back color when i am registering the class, e.g.: wincl.hbrBackground = CreateSolidBrush(RGB(202, 238, 255)); RegisterClassEx(&wincl); But how would i do it to any window i have created with the CreateWindow function? like a button on my main window, i have visual styles enabled, and i can notice the windows default gray...

EvtArchiveExportedLog fails with ERROR_DIRECTORY

I need to export some events from Windows Event Log to XML on Windows Server 2008 R2. To achieve it I export these events to a file using EvtExportLog and then try to use EvtArchiveExportedLog to get localized descriptions for events. Here's the sample: EvtExportLog( 0, 0, query, logFileName, EvtExportLogChannelPath ); EvtArchiveExporte...

How do I execute WinZip from Visual Studio without it's GUI opening?

int sysReturn = system("\"C:\\Program Files\\WinZip\\winzip32\" -a C:\\LOG\\test.zip C:\\LOG\\LOG_7-20-2010_17_8_48_834.csv"); Everything seems to work - as in it creates test.zip However, it opens the WinZip GUI (that shows how much has been compressed, etc while my program is running.) How can I skip that part where it doesn't ope...

Tell Windows XP to Standby programmatically

How can I tell Windows XP to switch to standby mode programmatically with C/C++ native code? ...

What HID device information is returned in LParam when a device is reported by the system?

I have been searching for information on this for about 30mins now and got nothing so far. Does anyone know what HID information is buried within LParam that's returned when the system (in this case windows) reports a system device change? (either removal or arrival) ...

Find the scroll unit of a window

Hi, I'm trying to find a way to compute the scroll unit (num. of pixels the screen moves down when u click once on the down arrow in the scrollbar). The msdn documentation for SB_LINEUP says : Decrements the scroll box position; scrolls toward the top of the data by one unit. In each case, a unit is defined by the application ...

Is there an environmental variable or equivalent for WinZip?

Is there an environmental variable or equivalent for WinZip32.exe I can use to find it's location path? EDIT - This is an in house tool for a controlled system. Thanks. ...

PHP is_file in Win32 allways return false

Hi all, I'm making a small app that must check if a certain file exists in the client computer. $file = "C:\\Windows\\System32\\rpnt.dll"; if (is_file($file)){ echo $file . " exists"; }else{ echo $file . " does not exist"; } Can't make this work. Any solution out there? ...

How to be notified of any update from Dynamic Data Exchange (DDE) ?

Hello, I was following the example from How to use Dynamic Data Exchange (DDE) with Word and Excel from Visual C++ and I somehow managed to able able to retrieve the value from the Excel. Now the question is, with this example, I have to run the application over again to get the necessary update. How do I make it in such a way that if ...

How can I map non-English Windows timezone names to Olsen names in Python?

If I call win32timezone.TimeZoneInfo.local().timeZoneName, it gives me the time zone name in the current locale (for example, on a Japanese machine, it returns u"東京 (標準時)"). I would like to map this name to an Olsen database timezone name for use with pytz. CLDR windowZones.xml helps me to map English names, but can't handle the Japanes...

MsiSetProperty from C# custom action

action1How do I set a MSI property from within a C# custom action, so far I have this but how do I get the handle? [DllImport("msi.dll", CharSet = CharSet.Unicode)] static extern int MsiSetProperty(IntPtr hInstall, string szName, string szValue); public void SetProperty(string propertyName, string propertyValue) { MsiSetProperty(ha...

delphi - calculate directory size API?

hi, Anyone knows other way to get a directoy's size, than calculate it's size by counting file with file? I'm interested on some win32 API function. I've google it about this, but i didn't found relevant information so i'm asking here. Best regards, PS: I know how to calculate a directory size by using findfirst and findnext and sum...

Can a FileStream be promoted from Read-Only to Read-Write?

Is there a way to promoting a Read-Only FileStream to Read-Write? I am looking for functionality similar to the Win32 SDK function ReOpenFile. ...