Search Results

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

Page 15/30 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • Custom Message Box: Windows' "Move Cursor to Default Button" Feature

    - by Andreas Rejbrand
    In Microsoft Windows, there is a (highly useful) feature that automatically moves the cursor to the default button of a modal dialog box (activated in Win+R, "control mouse"). Now I have created a custom dialog box in Delphi (basically a TForm), see below. But, quite naturally, the cursor does not automatically move to the default button ("Yes" in this case), even though the feature is turned on in "control mouse". How to implement this feature using Windows API? I guess it would be sufficient to obtain the settings as a boolean (true if feature activated, false if not), and then simply move the cursor programmatically using SetCursorPos if true. But how to obtain this setting?

    Read the article

  • keyboard layout direction

    - by mike
    hi, I would like to detect the direction of the current typing (input) language. I may detect the language by means of "GetKeyboardLayout", but then I'll have to check if it equals to Arabic or Hebrew and so on, is there any way just to detect the direction, i.e. left to right or right to left. thanks! mike.

    Read the article

  • how come we need not close the handle returned by ShellExecute ?

    - by fred-hh
    On success, ShellExecute returns a handle. Do we need to close this handle, and if so, how ? According to examples published my Microsoft, we need not close this handle. But the doc of ShellExecute itself is mute on the subject. Can you confirm we indeed do not need to close this handle ? But then, how can a handle be valid and in no need of being closed ??? Which of the following statements is/are true: the handle is invalid and we can't do anything with it; the handle is never freed and there is a (Microsoft-sponsored) memory leak (until the caller program ends); the handle is automatically freed by the system at some time and never reused afterwards (- another kind of resource leak). Only on trying to use it can we know whether it still points to something. what else ?

    Read the article

  • How can i get HWND of external application's listview? In Windows Api using c++

    - by Marko29
    So i am trying to make app to get content of my explorer listviews and get item text etc.. from it but here are the problems... If i inspect windows explorer folder(using spy++) with listview, just for testing purposes i will use random folder. It shows me that caption of the window is "FolderView" with class "SysListView32" and the top level window where this listview is nested is called "reference", this is also the title of windows explorer folder where all the files are. So what i do is.. HWND hWndLV = FindWindow(NULL, TEXT("reference")); // first i get hwnd of the main window, this is where listview window is also nested according to spy++, thats why i do this first. HWND child = FindWindowEx(hWndLV, NULL,NULL,TEXT("FolderView")); // trying to get hwnd of the listview here but it fails, same happens if i also put the class name along as HWND child = FindWindowEx(hWndLV, NULL,TEXT("SysListView32"),TEXT("FolderView")); I am using bool test = IsWindow(child); to test for fail, also VS debugger shows 0x0000000000 each time so i am sure i am reading results well. So i am stuck on this probably simple thing for most of people:( p.s. i am on vista64(if that matters anyhow) edit: It appears that this function works only if i search the first nested level of a parent window i am searching. So i assume what i need is a way to get handle with some sort of deep nested level search. I also tried to go step by step by defining hwnd of every parent then i use findwindowex on it but oh boy then i get to the point where there are 5 nested windows all with the same name and only one of them contains my listview, so nice uh?

    Read the article

  • IsValidLocale returns FALSE - how to overcome this?

    - by sharptooth
    When run on a Spanish version of Windows XP my program invokes LANGID langId = (LANGID) MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT ); LCID locale = MAKELCID( language, SORT_DEFAULT ); BOOL isValid = IsValidLocale( locale, LCID_INSTALLED ); IsValideLocale() return FALSE when asked about English locale. Obviously something must be tuned in Windows to change this behaviour. What exactly should I do? I understand that it's not completely a programming question but rather a deployment question. Still I think it will be better off here than anywhere else.

    Read the article

  • Qt grabWindow coordinates shifted from GetCursorPos and GetWindowRect

    - by user1391
    In Qt, when I use the QPixmap::grabWindow(hwnd,x,y,h,w) function, the coordinates are shifted slightly, when compared to the coordinates using the windows api functions GetCursorPos and GetWindowRect. i.e. (0,0) from the point of view of GetCursorPos and GetWindowRect is at the very top left of the toolbar at the top of the window. But (0,0) for QPixmap::grabWindow is more "inside" (i.e. ignoring the window frame). How can I make these 2 coordinates consistent? Especially since the user might have different thicknesses for the window frame?

    Read the article

  • How to catch exceptions from another program (for logging)?

    - by CuriousCoder
    I am working on a tool that monitors a number of applications and ensures they are always running and in a clean state. Some of these applications have unhandled exceptions which do occur periodically and present the 'send crash report' window. I do not have the source code to these applications. Is there any mechanism I could use to catch the exceptions, or simply identify their exception type, as well as identify the application's main executable file that threw the exception. I'm not trying to do anything crazy like catch and handle it on the applications behalf, I'm simply trying to capture the exception type, log it and then restart the application.

    Read the article

  • How to send Event signal through Processes - C

    - by Jamie Keeling
    Hello all! I have an application consisting of two windows, one communicates to the other and sends it a struct constaining two integers (In this case two rolls of a dice). I will be using events for the following circumstances: Process a sends data to process b, process b displays data Process a closes, in turn closing process b Process b closes a, in turn closing process a I have noticed that if the second process is constantly waiting for the first process to send data then the program will be just sat waiting, which is where the idea of implementing threads on each process occurred and I have started to implement this already. The problem i'm having is that I don't exactly have a lot of experience with threads and events so I'm not sure of the best way to actually implement what I want to do. I'm trying to work out how the other process will know of the event being fired so it can do the tasks it needs to do, I don't understand how one process that is separate from another can tell what the states the events are in especially as it needs to act as soon as the event has changed state. Thanks for any help Edit: I can only use the Create/Set/Open methods for events, sorry for not mentioning it earlier.

    Read the article

  • call to shellexecte causes antivirus to give a warning?

    - by omair iqbal
    when ever i write the following line of code any where in any app i program with delphi ShellExecute(self.WindowHandle,'open','www.yahoo.com',nil,nil, SW_SHOWNORMAL); kaspersky 2010 beeps this message ''behavior similar to pdm.hidden data sending. detected'' why is that and how do i get rid of this note: i am using delphi 2007

    Read the article

  • How do I patch a Windows API at runtime so that it to returns 0 in x64?

    - by Jorge Vasquez
    In x86, I get the function address using GetProcAddress() and write a simple XOR EAX,EAX; RET; in it. Simple and effective. How do I do the same in x64? bool DisableSetUnhandledExceptionFilter() { const BYTE PatchBytes[5] = { 0x33, 0xC0, 0xC2, 0x04, 0x00 }; // XOR EAX,EAX; RET; // Obtain the address of SetUnhandledExceptionFilter HMODULE hLib = GetModuleHandle( _T("kernel32.dll") ); if( hLib == NULL ) return false; BYTE* pTarget = (BYTE*)GetProcAddress( hLib, "SetUnhandledExceptionFilter" ); if( pTarget == 0 ) return false; // Patch SetUnhandledExceptionFilter if( !WriteMemory( pTarget, PatchBytes, sizeof(PatchBytes) ) ) return false; // Ensures out of cache FlushInstructionCache(GetCurrentProcess(), pTarget, sizeof(PatchBytes)); // Success return true; } static bool WriteMemory( BYTE* pTarget, const BYTE* pSource, DWORD Size ) { // Check parameters if( pTarget == 0 ) return false; if( pSource == 0 ) return false; if( Size == 0 ) return false; if( IsBadReadPtr( pSource, Size ) ) return false; // Modify protection attributes of the target memory page DWORD OldProtect = 0; if( !VirtualProtect( pTarget, Size, PAGE_EXECUTE_READWRITE, &OldProtect ) ) return false; // Write memory memcpy( pTarget, pSource, Size ); // Restore memory protection attributes of the target memory page DWORD Temp = 0; if( !VirtualProtect( pTarget, Size, OldProtect, &Temp ) ) return false; // Success return true; } This example is adapted from code found here: http://www.debuginfo.com/articles/debugfilters.html#overwrite .

    Read the article

  • How to preview any files inside a Java application ?

    - by Studer
    I'm using a JTree to browse the content of a folder and I want that when a user click on a file, the software shows a preview of it (a screenshot of its first page). The files are mostly Office documents and PDF. I manage to do it for PDF file using a module downloaded from Sun, but I'd like to know if there is a way to do it using any software (JARs preferably) or even the built-in Windows API. I was thinking of converting the file to PDF then do a preview of this PDF but this isn't optimal. Any ideas ?

    Read the article

  • Win32 Window Menu is appearing along left side instead of across top of window

    - by Khat
    I think I may be using a wrong window style or something or maybe just adding the menu to the window incorrectly. I'll post a link to an image here so you can see what I mean about the menu not diplaying correctly: http://img707.imageshack.us/img707/4828/wtfmenu.jpg And here's a link to the code that creates the menu and the window: http://pastebin.com/CBrSVXUD I'm sure I'm missing something simple and dumb in the labyrinth of styles, settings and etc that are part and parcel for the Win32 API. Has anyone seen this before and know what I'm doing wrong? I just want a 'normal' menu bar along the top, snug against the title bar. Thanks in advance for any advice.

    Read the article

  • How to set a sorting mode in Open Dialog

    - by Serg
    A user can manually sort files in a standard Windows Open Dialog (in "Details" view mode) by Name, Date or Size by clicking on the corresponding column header. How to set a sorting mode in Open Dialog (TOpenDialog class in Delphi) programmatically in application so that the dialog opens with a preferred sorting?

    Read the article

  • High-level languages for out-of-the-box GUI desktop application programming

    - by Omeoe
    After I discontinued programming in C++ while entering into web authoring I was spoilt by PHP's high level constructs like hash tables or its dynamic, weak typing. I remembered the angst of C/C++ pointers and the maze of low-level Win32 API handles and message loops and that prevented me from utilizing environments like Code::Blocks for desktop applications. I am also not very fond of bulky, statically-typed C#/.NET environment. Any other ideas?

    Read the article

  • What's the recommended implementation for hashing OLE Variants?

    - by Barry Kelly
    OLE Variants, as used by older versions of Visual Basic and pervasively in COM Automation, can store lots of different types: basic types like integers and floats, more complicated types like strings and arrays, and all the way up to IDispatch implementations and pointers in the form of ByRef variants. Variants are also weakly typed: they convert the value to another type without warning depending on which operator you apply and what the current types are of the values passed to the operator. For example, comparing two variants, one containing the integer 1 and another containing the string "1", for equality will return True. So assuming that I'm working with variants at the underlying data level (e.g. VARIANT in C++ or TVarData in Delphi - i.e. the big union of different possible values), how should I hash variants consistently so that they obey the right rules? Rules: Variants that hash unequally should compare as unequal, both in sorting and direct equality Variants that compare as equal for both sorting and direct equality should hash as equal It's OK if I have to use different sorting and direct comparison rules in order to make the hashing fit. The way I'm currently working is I'm normalizing the variants to strings (if they fit), and treating them as strings, otherwise I'm working with the variant data as if it was an opaque blob, and hashing and comparing its raw bytes. That has some limitations, of course: numbers 1..10 sort as [1, 10, 2, ... 9] etc. This is mildly annoying, but it is consistent and it is very little work. However, I do wonder if there is an accepted practice for this problem.

    Read the article

  • Update of application Icon in Windows-7 Taskbar

    - by Florian W.
    I have a normal MFC Application with an embedded icon. If I start the application, the icon is shown inside the windows-7 taskbar. But when I change the icon inside the resources, rebuild the application and start it, the taskbar doesn't show the current icon, but the icon from the first run. There is no special code inside the application that does something specific with the windows-7 taskbar. Is there a way, (in C++) to tell the windows-7 taskbar to show the current icon?

    Read the article

  • Why does GetWindowThreadProcessId return 0 when called from a service

    - by Marve
    When using the following class in a console application, and having at least one instance of Notepad running, GetWindowThreadProcessId correctly returns a non-zero thread id. However, if the same code is included in a Windows Service, GetWindowThreadProcessId always returns 0 and no exceptions are thrown. Changing the user the service launches under to be the same as the one running the console application didn't alter the result. What causes GetWindowThreadProcessId to return 0 even if it is provided with a valid hwnd? And why does it function differently in the console application and the service? Note: I am running Windows 7 32-bit and targeting .NET 3.5. public class TestClass { [DllImport("user32.dll")] static extern uint GetWindowThreadProcessId(IntPtr hWnd, IntPtr ProcessId); public void AttachToNotepad() { var processesToAttachTo = Process.GetProcessesByName("Notepad") foreach (var process in processesToAttachTo) { var threadID = GetWindowThreadProcessId(process.MainWindowHandle, IntPtr.Zero); .... } } } Console Code: class Program { static void Main(string[] args) { var testClass = new TestClass(); testClass.AttachToNotepad(); } } Service Code: public class TestService : ServiceBase { private TestClass testClass = new TestClass(); static void Main() { ServiceBase.Run(new TestService()); } protected override void OnStart(string[] args) { testClass.AttachToNotepad(); base.OnStart(args); } protected override void OnStop() { ... } }

    Read the article

  • Cannot call DLL import entry in C# from C++ project. EntryPointNotFoundException

    - by kriau
    I'm trying to call from C# a function in a custom DLL written in C++. However I'm getting the warning during code analysis and the error at runtime: Warning: CA1400 : Microsoft.Interoperability : Correct the declaration of 'SafeNativeMethods.SetHook()' so that it correctly points to an existing entry point in 'wi.dll'. The unmanaged entry point name currently linked to is SetHook. Error: System.EntryPointNotFoundException was unhandled. Unable to find an entry point named 'SetHook' in DLL 'wi.dll'. Both projects wi.dll and C# exe has been compiled in to the same DEBUG folder, both files reside here. There is only one file with the name wi.dll in the whole file system. C++ function definition looks like: #define WI_API __declspec(dllexport) bool WI_API SetHook(); I can see exported function using Dependency Walker: as decorated: bool SetHook(void) as undecorated: ?SetHook@@YA_NXZ C# DLL import looks like (I've defined these lines using CLRInsideOut from MSDN magazine): [DllImport("wi.dll", EntryPoint = "SetHook", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAsAttribute(UnmanagedType.I1)] internal static extern bool SetHook(); I've tried without EntryPoint and CallingConvention definitions as well. Both projects are 32-bits, I'm using W7 64 bits, VS 2010 RC. I believe that I simply have overlooked something.... Thanks in advance.

    Read the article

  • How to prevent form from being activated when the users clicks on it?

    - by riot_starter
    I have a main form and non-modal autocomplete form. How can I prevent the autocomplete form from being activated by the user, when the user clicks on the list in the autocomplete form? So, basically I want the autocomplete form the receive the mouse click message when the users clicks, but to never become active, because it causes problems with a third-party component in the main form over which I have no control.

    Read the article

  • Using CreateWindow() to make additional Window on a thread - C

    - by Jamie Keeling
    Hello, I have a windows form that has a simple menu and performs a simple operation, I want to be able to create another windows form with all the functionality of a menu bar, message pump etc.. as a separate thread so I can then share the results of the operation to the second window. I.E. 1) Form A opens Form B opens as a separate thread 2)Form A performs operation 3)Form A passes results via memory to Form B 4)Form B display results I'm confused as to how to go about it, the main app runs fine but i'm not sure how to add a second window if the first one already exists. I think that using CreateWindow will allow me to make another window but again i'm not sure how to access the message pump so I can respond to certain events like WM_CREATE on the second window. I hope it makes sense. Thanks!

    Read the article

  • FindWindowEx from user32.dll is returning a handle of Zero and error code of 127 using dllimport

    - by puretechy
    I need to handle another windows application programatically, searching google I found a sample which handles windows calculator using DLLImport Attribute and importing the user32.dll functions into managed ones in C#. The application is running, I am getting the handle for the main window i.e. Calculator itself, but the afterwards code is not working. The FindWindowEx method is not returning the handles of the children of the Calculator like buttons and textbox. I have tried using the SetLastError=True on DLLImport and found that I am getting an error code of 127 which is "Procedure not found". This is the link from where I got sample application: http://www.codeproject.com/script/Articles/ArticleVersion.aspx?aid=14519&av=34503 Please help if anyone knows how to solve it. UPDATE: The DLLImport is: [DllImport("user32.dll", SetLastError = true)] public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className, string windowTitle); The Code that is not working is: hwnd=FindWindow(null,"Calculator"); // This is working, I am getting handle of Calculator // The following is not working, I am getting hwndChild=0 and err = 127 hwndChild = FindWindowEx((IntPtr)hwnd,IntPtr.Zero,"Button","1"); Int32 err = Marshal.GetLastWin32Error();

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >