Search Results

Search found 746 results on 30 pages for 'winapi'.

Page 7/30 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Retrieving virtual disk file name from disk number

    - by Josip Medved
    When I list virtual disks within diskpart: DISKPART> list vdisk VDisk ### Disk ### State Type File --------- -------- -------------------- --------- ---- VDisk 0 Disk 2 Attached not open Fixed C:\Disk.vhd Interesting part for me here is file name. I tried to find equivalent of function that would give me file name (under File column) if I know disk number. Any idea which function that might be?

    Read the article

  • Programatically enable / disable multitouch finger input?

    - by winSharp93
    I have a multitoch-enabled tablet PC running Windows 7. However, when using the stylus pen and getting too far away from the display, I often accidently hit it with my fingers which causes unwanted mouse-clicks. The solution is navigating to "Control Panel - Pen- and Finger Input - Finger Input" and deactivate the checkbox "Use the finger as an input device" (all titles translated so they might be different on an English windows). Now I am wondering whether I can do this programatically, too, so I would be able to write a little tray app for this. I tried using Process Monitor to find out registry keys, however, I did not find one which really shows the same effect as the checkbox. Does anyone know how to access this property (without using UI-Automation)? Cheers winSharp93

    Read the article

  • Problem with Keyboard hook proc

    - by Steve
    The background: My form has a TWebBrowser. I want to close the form with ESC but the TWebBrowser eats the keystrokes - so I decided to go with a keyboard hook. The problem is that the Form can be open in multiple instances at the same time. No matter what I do, in some situations, if there are two instances open of my form, closing one of them closes the other as well. I've attached some sample code. Any ideas on what causes the issue? var EmailDetailsForm: TEmailDetailsForm; KeyboardHook: HHook; implementation function KeyboardHookProc(Code: Integer; wParam, lParam: LongInt): LongInt; stdcall; var hWnd: THandle; I: Integer; F: TForm; begin if Code < 0 then Result := CallNextHookEx(KeyboardHook, Code, wParam, lParam) else begin case wParam of VK_ESCAPE: if (lParam and $80000000) <> $00000000 then begin hWnd := GetForegroundWindow; for I := 0 to Screen.FormCount - 1 do begin F := Screen.Forms[I]; if F.Handle = hWnd then if F is TEmailDetailsForm then begin PostMessage(hWnd, WM_CLOSE, 0, 0); Result := HC_SKIP; break; end; end; //for end; //if else Result := CallNextHookEx(KeyboardHook, Code, wParam, lParam); end; //case end; //if end; function TEmailDetailsForm.CheckInstance: Boolean; var I, J: Integer; F: TForm; begin Result := false; J := 0; for I := 0 to Screen.FormCount - 1 do begin F := Screen.Forms[I]; if F is TEmailDetailsForm then begin J := J + 1; if J = 2 then begin Result := true; break; end; end; end; end; procedure TEmailDetailsForm.FormCreate(Sender: TObject); begin if not CheckInstance then KeyboardHook := SetWindowsHookEx(WH_KEYBOARD, @KeyboardHookProc, 0, GetCurrentThreadId()); end; procedure TEmailDetailsForm.FormDestroy(Sender: TObject); begin if not CheckInstance then UnHookWindowsHookEx(KeyboardHook); end;

    Read the article

  • Is an LSA MSV1_0 subauthentication package needed for some impersonation use cases?

    - by Chris Sears
    Greetings, I'm working with a vendor who has implemented some code that uses a Windows LSA MSV1_0 subauthentication package (MSDN info if you're interested: http://msdn.microsoft.com/en-us/library/aa374786(VS.85).aspx ) and I'm trying to figure out if it's necessary. As far as I can tell, the subauthentication routine and filter allow for hooking or customizing the standard LSA MSV1_0 logon event processing. The issue is that I don't understand why the vendor's product would need these capabilities. I've asked them and they said they use it to perform impersonation. The product definitely does need to do impersonation, but based on my limited win32 knowledge, they could get the functionality they need using the normal auth APIs (LsaLogonUser, ImpersonateLoggedOnUser, etc) without the subauthentication package. Furthermore, I've worked with a number of similar products that all do impersonation, and this is the only one that's used a subauthentication package. If you're wondering why I would care, a previous version of the product had a bug in the subauthentication package dll that would cause lockups or bluescreens. That makes me rather nervous and has me questioning the use of such a low-level, kernel sensitive interface. I'd like to go back to the vendor and say "There's no way you could need an LSA subauth package for impersonation - take it out", but I'm not sure I understand the use cases and possible limitations of the standard win32 authentication/impersonation APIs well enough to make that claim definitively. So, to the win32 security gurus out there, is there any reason you would need an LSA MSV1_0 subauthentication package if all you were doing is impersonation? Thanks in advance for any thoughts!

    Read the article

  • Error compiling Win32 API GUI code with MinGW

    - by Eric Larsen
    Hey guys, this is my first post. I'm just getting started with win32 API programming in C++ and I'm having trouble compiling the winnie tutorial (http://www.relisoft.com/win32/winnie.html) with MinGW. My input and output: C:\Users\Eric\Projects g++ winnie.cpp -o winnie.exe /mingw/lib/libmingw32.a(main.o):main.c:(.text+0xd2): undefined reference to 'WinMain@16' collect2: ld returned 1 exit status Any help would be very much appreciated.

    Read the article

  • Sharing HDC between different processes

    - by Heinrich Ulbricht
    Hi, I am writing some kind of IPC functionality and need to pass certain resources from one process to another. This works well for Pipe handles etc. which can be duplicated via DuplicateHandle. Now I need to pass a HDC from one process to the other. Is this even possible? If yes: how? Sub-Question: I am assuming passing window handles (HWND) from one process to the other is safe. Is this assumption correct? Thanks for your help!

    Read the article

  • Ctypes pro and con

    - by phreaki
    I have heard that Ctypes can cause crashes (or stop errors) in Python and windows. Should I stay away from their use? Where did I hear? It was back when I tried to control various aspects of windows, automation, that sort of thing. I hear of swig, but I see Ctypes more often than not. Any danger here? If so, what should I watch out for? I did search for ctype pro con python.

    Read the article

  • Taking screenshot with Win32 API (C# pInvoke) not working in IIS

    - by Dillen Meijboom
    I want to take a screenshot of an external website. Currently my workflow is to start a Firefox instance with the specified URL and take a screenshot using PrintWindow in the Win32 API When I run this application in IISExpress it works fine but when I run the same application in IIS on a windows VPS it is not working (screenshot is blank). I don't know what I'm doing wrong? My code: using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; using System.Linq; using System.Runtime.InteropServices; using System.Security; using System.Threading; using System.Web; namespace WebTools.Web { public class RemoteScreenshot { public static Bitmap TakeScreenshot(Process process) { // may need a process Refresh before return TakeScreenshot(process.MainWindowHandle); } public static Bitmap TakeScreenshot(IntPtr handle) { RECT rc = new RECT(); GetWindowRect(handle, ref rc); Bitmap bitmap = new Bitmap(rc.right - rc.left, rc.bottom - rc.top); using (Graphics graphics = Graphics.FromImage(bitmap)) { PrintWindow(handle, graphics.GetHdc(), 0); } return bitmap; } [DllImport("user32.dll")] private static extern bool GetWindowRect(IntPtr hWnd, ref RECT rect); [DllImport("user32.dll")] private static extern bool PrintWindow(IntPtr hWnd, IntPtr hDC, int flags); [StructLayout(LayoutKind.Sequential)] private struct RECT { public int left; public int top; public int right; public int bottom; } public static void Save(string url, string file, int timeout = 0) { Process.Start(new ProcessStartInfo("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe", url) { CreateNoWindow = false, WindowStyle = ProcessWindowStyle.Maximized }); Thread.Sleep(timeout); var bitmap = TakeScreenshot(Process.GetProcessesByName("firefox").First()); bitmap.Save(file, ImageFormat.Png); bitmap.Dispose(); Process.GetProcessesByName("firefox").First().Kill(); } } } EDIT: Running Firefox works fine because the AppPool is under another account that has the rights to execute firefox.

    Read the article

  • Override tooltip text for Titlebar buttons (Close, Maximize, Minimize, Help)

    - by Tim
    I have been trying without luck to change the text of the tooltip that appears for the buttons on the main title bar of a form. In a nutshell, we have harnessed the 'Help' button for Windows Forms to have some other purpose. This is working fine. The issue is that when hovering the mouse over that button, a 'Help' tooltip appears, which doesn't make any sense for the application. Ideally, there would be some way to change the text of that tooltip for my application; however, at this point I would be satisfied just finding a way to disable the tooltips altogether. I know that you can disable the tooltips for the entire OS by modifying the 'UserPreferencesMask' key in regedit, but I would really like a way to have this only affect my application. Again, ideally there would be some way to do this with managed code, but I would not be opposed to linking into the Windows API or the like. Thanks for any suggestions for resolving this issue!

    Read the article

  • How define charset for HTMLhelp?

    - by Oleg Svechkarenko
    My C++ windows program uses htmlhelp. Structure HH_POPUP includes field pszFont in format: "Facename[, point size[, CHARSET[, color[, PLAIN BOLD ITALIC UNDERLINE]]]]", but I cannot find any info about way to define the charset. My russian popup help is totally unreadeable. HH_POPUP popupAttr; memset(&popupAttr, 0, sizeof(popupAttr)); popupAttr.cbStruct = sizeof(popupAttr); popupAttr.clrBackground = COLORREF(-1); popupAttr.clrForeground = COLORREF(-1); popupAttr.rcMargins.left = -1; popupAttr.rcMargins.bottom = -1; popupAttr.rcMargins.right = -1; popupAttr.idString = UINT(helpInfo->dwContextId); popupAttr.pt = helpInfo->MousePos; popupAttr.pszFont = _T("Arial,18,HOW_TO_DEFINE_THIS_CHARSET"); // please!!! CWnd::GetDesktopWindow()->HtmlHelp(reinterpret_cast<DWORD>(&popupAttr), HH_DISPLAY_TEXT_POPUP);

    Read the article

  • Getting rid of the evil delay caused by ShellExecute

    - by korona
    This is something that's been bothering me a while and there just has to be a solution to this. Every time I call ShellExecute to open an external file (be it a document, executable or a URL) this causes a very long lockup in my program before ShellExecute spawns the new process and returns. Does anyone know how to solve or work around this? EDIT: And as the tags might indicate, this is on Win32 using C++.

    Read the article

  • Windows Vista, Default Programs API, file format associations, and (un)installers - explosive mix!

    - by Alex T.
    My application is a rather well behaved Windows citizen, so when I ported it to Windows Vista/7 I replaced my custom file format association code with support for the Default Programs API. However I ran into a problem when trying to make uninstaller for my application - there seems to be no way to remove file format associations via Default Programs API. I tried to call IApplicationAssociationRegistration::ClearUserAssociations but it actually removes all associations, including the ones for other applications - completely restoring default state of the OS (which is of course unacceptable). I tried to call IApplicationAssociationRegistration::SetAppAsDefault to return file format associations to the previous "owner" - but it does not help, because my application handles many unique file formats which the OS does not support and there is no previous "owners". And Windows does not allow to pass empty strings to SetAppAsDefault... So what do I do? Any good solutions?

    Read the article

  • How can I detect message boxes popping up in another process?

    - by Frerich Raabe
    I'd like to execute some code whenever a (any!) message box (as spawned by the MessageBox Function) is shown in another process. I didn't start the process I'm monitoring. I can think of three approaches: Install a global CBT Hook procedure which tells me whenever a window is created on the desktop. Then, check whether the window belongs to the process I'm monitoring and whether the class name is #32770 (which is the class name of dialogs according to the About Window Classes page at the MSDN). This would probably work, but it would pull the DLL which contains the hook procedure into virtually every process on the desktop, and the hook procedure gets called a lot. It smells like a potential perfomance problem. Try to subclass the #32770 system window class (is this possible at all?) and look for WM_CREATE messages in my custom window procedure. Intercept the MessageBox Function API call (even though the remote process is running already!) and call my code from the hook function. So far, I only know that the first idea is feasible, but it seems really inefficient. Can anybody think of a simpler solution than that to this problem?

    Read the article

  • Releasing an OLE IStorage file handle in C#

    - by Bernard Darnton
    I'm trying to embed a PDF file into a Word document using the OLE technique described here: http://blogs.msdn.com/brian_jones/archive/2009/07/21/embedding-any-file-type-like-pdf-in-an-open-xml-file.aspx I've tried to implement to C++ code provided in C# so that the whole project's in one place and am almost there except for one roadblock. When I try to feed the generated OLE object binary data into the Word document I get an IOException. IOException: The process cannot access the file 'C:\Wherever\Whatever.pdf.bin' because it is being used by another process. There is a file handle open the .bin file and I don't know how to get rid of it. I don't know a huge amount about COM - I'm winging it here - and I don't know where the file handle is or how to release it. Here's what my C#-ised code looks like. What am I missing? public void ExportOleFile(string oleOutputFileName, string emfOutputFileName) { OLE32.IStorage storage; var result = OLE32.StgCreateStorageEx( oleOutputFileName, OLE32.STGM.STGM_READWRITE | OLE32.STGM.STGM_SHARE_EXCLUSIVE | OLE32.STGM.STGM_CREATE | OLE32.STGM.STGM_TRANSACTED, OLE32.STGFMT.STGFMT_DOCFILE, 0, IntPtr.Zero, IntPtr.Zero, ref OLE32.IID_IStorage, out storage ); var CLSID_NULL = Guid.Empty; OLE32.IOleObject pOle; result = OLE32.OleCreateFromFile( ref CLSID_NULL, _inputFileName, ref OLE32.IID_IOleObject, OLE32.OLERENDER.OLERENDER_NONE, IntPtr.Zero, null, storage, out pOle ); result = OLE32.OleRun(pOle); IntPtr unknownFromOle = Marshal.GetIUnknownForObject(pOle); IntPtr unknownForDataObj; Marshal.QueryInterface(unknownFromOle, ref OLE32.IID_IDataObject, out unknownForDataObj); var pdo = Marshal.GetObjectForIUnknown(unknownForDataObj) as IDataObject; var fetc = new FORMATETC(); fetc.cfFormat = (short)OLE32.CLIPFORMAT.CF_ENHMETAFILE; fetc.dwAspect = DVASPECT.DVASPECT_CONTENT; fetc.lindex = -1; fetc.ptd = IntPtr.Zero; fetc.tymed = TYMED.TYMED_ENHMF; var stgm = new STGMEDIUM(); stgm.unionmember = IntPtr.Zero; stgm.tymed = TYMED.TYMED_ENHMF; pdo.GetData(ref fetc, out stgm); var hemf = GDI32.CopyEnhMetaFile(stgm.unionmember, emfOutputFileName); storage.Commit((int)OLE32.STGC.STGC_DEFAULT); pOle.Close(0); GDI32.DeleteEnhMetaFile(stgm.unionmember); GDI32.DeleteEnhMetaFile(hemf); }

    Read the article

  • Trim a string in C

    - by Orion Edwards
    Briefly: I'm after the equivalent of .NET's String.Trim in C using the win32 and standard C api (compiling with MSVC2008 so I have access to all the C++ stuff if needed, but I am just trying to trim a char*). Given that there is strchr, strtok, and all manner of other string functions, surely there should be a trim function, or one that can be repurposed... Thanks

    Read the article

  • Far jump in ntdll.dll's internal ZwCreateUserProcess

    - by user49164
    I'm trying to understand how the Windows API creates processes so I can create a program to determine where invalid exes fail. I have a program that calls kernel32.CreateProcessA. Following along in OllyDbg, this calls kernel32.CreateProcessInternalA, which calls kernel32.CreateProcessInternalW, which calls ntdll.ZwCreateUserProcess. This function goes: mov eax, 0xAA xor ecx, ecx lea edx, dword ptr [esp+4] call dword ptr fs:[0xC0] add esp, 4 retn 0x2C So I follow the call to fs:[0xC0], which contains a single instruction: jmp far 0x33:0x74BE271E But when I step this instruction, Olly just comes back to ntdll.ZwCreateUserProcess at the add esp, 4 right after the call (which is not at 0x74BE271E). I put a breakpoint at retn 0x2C, and I find that the new process was somehow created during the execution of add esp, 4. So I'm assuming there's some magic involved in the far jump. I tried to change the CS register to 0x33 and EIP to 0x74BE271E instead of actually executing the far jump, but that just gave me an access violation after a few instructions. What's going on here? I need to be able to delve deeper beyond the abstraction of this ZwCreateUserProcess to figure out how exactly Windows creates processes.

    Read the article

  • Add newline to a text field (Win32)

    - by user146780
    I'm making a Notepad clone. Right now my text loads fine but where their are newline characters, they do not make newlines in the text field. I load it like this: void LoadText(HWND ctrl,HWND parent) { int leng; char buf[330000]; char FileBuffer[500]; memset(FileBuffer,0,500); FileBuffer[0] = '*'; FileBuffer[1] = '.'; FileBuffer[2] = 't'; FileBuffer[3] = 'x'; FileBuffer[4] = 't'; OPENFILENAMEA ofn; memset(&ofn, 0, sizeof(OPENFILENAMEA)); ofn.lStructSize = sizeof(OPENFILENAMEA); ofn.hwndOwner = parent; ofn.lpstrFile = FileBuffer; ofn.nMaxFile = 500; ofn.lpstrFilter = "Filetype (*.txt)\0\0"; ofn.lpstrDefExt = "txt"; ofn.Flags = OFN_EXPLORER; if(!GetOpenFileNameA(&ofn)) { return; } ifstream *file; file = new ifstream(FileBuffer,ios::in); int lenn; lenn = 0; while (!file->eof()) { buf[lenn] = file->get(); lenn += 1; } buf[lenn - 1] = 0; file->read(buf,lenn); SetWindowTextA(ctrl,buf); file->close(); } How can I make it do the new line characters? Thanks

    Read the article

  • How to know a file is finished copying

    - by Yigang Wu
    I’m using ReadDirectoryChangesW to spy a folder, if I’m copying a large file to the folder, I can receive multiple FILE_ACTION_MODIFIED messages, it seems each time windows writes a large chunk of the file, you get the file modified notification for each time. I tried to use CreateFile API to check if the file can open by AP or not, but sometime, some of files are always locked by other AP, for example, if you are opening the Outlook, the PST will update, but my AP can’t access it, we have to start Shadow Copy to open it. So my question is, how to know a file is finished copying?

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >