Search Results

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

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

  • Win32: IProgressDialog will not disappear until you mouse over it.

    - by Ian Boyd
    i'm using the Win32 progress dialog. The damnest thing is that when i call: progressDialog.StopProgressDialog(); it doesn't disappear. It stays on screen until the user moves her mouse over it - then it suddenly disappers. The call to StopProgressDialog returns right away (i.e. it's not a synchronous call). i can prove this by doing things after the call has returned: private void button1_Click(object sender, EventArgs e) { //Force red background to prove we've started this.BackColor = Color.Red; this.Refresh(); //Start a progress dialog IProgressDialog pd = (IProgressDialog)new ProgressDialog(); pd.StartProgressDialog(this.Handle, null, PROGDLG.Normal, IntPtr.Zero); //The long running operation System.Threading.Thread.Sleep(10000); //Stop the progress dialog pd.SetLine(1, "Stopping Progress Dialog", false, IntPtr.Zero); pd.StopProgressDialog(); pd = null; //Return form to normal color to prove we've stopped. this.BackColor = SystemColors.Control; this.Refresh(); } The form: starts gray turns red to show we've stared turns back to gray color to show we've called stop So the call to StopProgressDialog has returned, except the progress dialog is still sitting there, mocking me, showing the message: Stopping Progress Dialog Doesn't Appear for 10 seconds Additionally, the progress dialog does not appear on screen until the System.Threading.Thread.Sleep(10000); ten second sleep is over. Not limited to .NET WinForms The same code also fails in Delphi, which is also an object wrapper around Window's windows: procedure TForm1.Button1Click(Sender: TObject); var pd: IProgressDialog; begin Self.Color := clRed; Self.Repaint; pd := CoProgressDialog.Create; pd.StartProgressDialog(Self.Handle, nil, PROGDLG_NORMAL, nil); Sleep(10000); pd.SetLine(1, StringToOleStr('Stopping Progress Dialog'), False, nil); pd.StopProgressDialog; pd := nil; Self.Color := clBtnFace; Self.Repaint; end; PreserveSig An exception would be thrown if StopProgressDialog was failing. Most of the methods in IProgressDialog, when translated into C# (or into Delphi), use the compiler's automatic mechanism of converting failed COM HRESULTS into a native language exception. In other words the following two signatures will throw an exception if the COM call returned an error HRESULT (i.e. a value less than zero): //C# void StopProgressDialog(); //Delphi procedure StopProgressDialog; safecall; Whereas the following lets you see the HRESULT's and react yourself: //C# [PreserveSig] int StopProgressDialog(); //Delphi function StopProgressDialog: HRESULT; stdcall; HRESULT is a 32-bit value. If the high-bit is set (or the value is negative) it is an error. i am using the former syntax. So if StopProgressDialog is returning an error it will be automatically converted to a language exception. Note: Just for SaG i used the [PreserveSig] syntax, the returned HRESULT is zero; MsgWait? The symptom is similar to what Raymond Chen described once, which has to do with the incorrect use of PeekMessage followed by MsgWaitForMultipleObjects: "Sometimes my program gets stuck and reports one fewer record than it should. I have to jiggle the mouse to get the value to update. After a while longer, it falls two behind, then three..." But that would mean that the failure is in IProgressDialog, since it fails equally well on CLR .NET WinForms and native Win32 code.

    Read the article

  • Why this structure should have 48 bytes

    - by Maksee
    I tried to translate some new part of winuser.h header to Delphi. Why this structure is expected to be 48 bytes (only this size was accepted by the corresponding function). With 4-bytes boundary, it looks like it should have 40 bytes. typedef struct tagGESTUREINFO { UINT cbSize; DWORD dwFlags; DWORD dwID; HWND hwndTarget; POINTS ptsLocation; DWORD dwInstanceID; DWORD dwSequenceID; ULONGLONG ullArguments; UINT cbExtraArgs; } GESTUREINFO, *PGESTUREINFO; If it's related to 8-bytes boundary? if so is it relevant to any case where ULONGLONG appears structures? Thanks

    Read the article

  • Difference between WinMain and wWinMain

    - by Sherwood Hu
    The only difference is that Winmain takes char* for lpCmdLine parameter, while wWinMain takes wchar_t*. On Windows XP, if an application entry is WinMain, does Windows convert the command line from Unicode to Ansi and pass to the application? If the command line parameter must be in Unicode (for example, Unicode file name, conversion will cause some characters missing), does that mean that I must use wWinMain as the entry function?

    Read the article

  • How can I quickly enumerate directories on Win32?

    - by BillyONeal
    Hello everyone :) I'm trying to speedup directory enumeration in C++, where I'm recursing into subdirectories. I currently have an app which spends 95% of it's time in FindFirst/FindNextFile APIs, and it takes several minutes to enumerate all the files on a given volume. I know it's possible to do this faster because there is an app that does: Everything. It enumerates my entire drive in seconds. How might I accomplish something like this?

    Read the article

  • Monitor serial port already open

    - by Cristiano
    Hi, I am try to read data over serial port already open. I have used C# and c++ library for use microsoft api (overlapped and not overlapped I/O), but not work. I can use same windows api? or other?? Thanks in advance for your availability, Cristiano http://bugbusters.altervista.org/index.php

    Read the article

  • Giving dialogbox focus

    - by Dave18
    I'm creating a dialogbox with a picture control and whenever I initialize the dialog it sets the focus to that picture control, is there any way to give dialog the default without resetting the focus from picture control?

    Read the article

  • Enumerating File Handles in C#

    - by user293392
    I would like to know whether it is possible to enumerate file handles in c#, maybe using Win32API. This is easily done for window and process handles, but it seems that it is not possible for file handles. While some functionality is offered by NtQuerySystemInformation, this is being phased out and therefore it is not recommended to use such a method.

    Read the article

  • How can I determine which taskbar application/windows are requesting user attention

    - by Frederic
    I'd like to know how to get a list of the windows requiring user attention from the Windows taskbar. Windows requiring attention appear with a flashing orange color within the Windows taskbar. Un-focused MSN Messenger conversation windows are a good example of this behavior: they turn orange as soon as a remote user sends an instance message. My code targets the Windows 7 platform, but working on older Windows OS would be nice too.

    Read the article

  • Disable antialiasing for a specific GDI device context

    - by Jacob Stanley
    I'm using a third party library to render an image to a GDI DC and I need to ensure that any text is rendered without any smoothing/antialiasing so that I can convert the image to a predefined palette with indexed colors. The third party library i'm using for rendering doesn't support this and just renders text as per the current windows settings for font rendering. They've also said that it's unlikely they'll add the ability to switch anti-aliasing off any time soon. The best work around I've found so far is to call the third party library in this way (error handling and prior settings checks ommitted for brevity): private static void SetFontSmoothing(bool enabled) { int pv = 0; SystemParametersInfo(Spi.SetFontSmoothing, enabled ? 1 : 0, ref pv, Spif.None); } // snip Graphics graphics = Graphics.FromImage(bitmap) IntPtr deviceContext = graphics.GetHdc(); SetFontSmoothing(false); thirdPartyComponent.Render(deviceContext); SetFontSmoothing(true); This obviously has a horrible effect on the operating system, other applications flicker from cleartype enabled to disabled and back every time I render the image. So the question is, does anyone know how I can alter the font rendering settings for a specific DC? Even if I could just make the changes process or thread specific instead of affecting the whole operating system, that would be a big step forward! (That would give me the option of farming this rendering out to a separate process- the results are written to disk after rendering anyway) EDIT: I'd like to add that I don't mind if the solution is more complex than just a few API calls. I'd even be happy with a solution that involved hooking system dlls if it was only about a days work. EDIT: Background Information The third-party library renders using a palette of about 70 colors. After the image (which is actually a map tile) is rendered to the DC, I convert each pixel from it's 32-bit color back to it's palette index and store the result as an 8bpp greyscale image. This is uploaded to the video card as a texture. During rendering, I re-apply the palette (also stored as a texture) with a pixel shader executing on the video card. This allows me to switch and fade between different palettes instantaneously instead of needing to regenerate all the required tiles. It takes between 10-60 seconds to generate and upload all the tiles for a typical view of the world. EDIT: Renamed GraphicsDevice to Graphics The class GraphicsDevice in the previous version of this question is actually System.Drawing.Graphics. I had renamed it (using GraphicsDevice = ...) because the code in question is in the namespace MyCompany.Graphics and the compiler wasn't able resolve it properly. EDIT: Success! I even managed to port the PatchIat function below to C# with the help of Marshal.GetFunctionPointerForDelegate. The .NET interop team really did a fantastic job! I'm now using the following syntax, where Patch is an extension method on System.Diagnostics.ProcessModule: module.Patch( "Gdi32.dll", "CreateFontIndirectA", (CreateFontIndirectA original) => font => { font->lfQuality = NONANTIALIASED_QUALITY; return original(font); }); private unsafe delegate IntPtr CreateFontIndirectA(LOGFONTA* lplf); private const int NONANTIALIASED_QUALITY = 3; [StructLayout(LayoutKind.Sequential)] private struct LOGFONTA { public int lfHeight; public int lfWidth; public int lfEscapement; public int lfOrientation; public int lfWeight; public byte lfItalic; public byte lfUnderline; public byte lfStrikeOut; public byte lfCharSet; public byte lfOutPrecision; public byte lfClipPrecision; public byte lfQuality; public byte lfPitchAndFamily; public unsafe fixed sbyte lfFaceName [32]; }

    Read the article

  • JW Player - How can I add an event listener for fullscreen toggling?

    - by Charles
    I'm using JW Player 4.5 on my site and I need to add an event listener for when fullscreen is toggled. The reason for this is to switch between a low-def version and high-def version. The default video will be the low-def version and when they switch to a fullscreen display, it will change to the high-def version. According to http://developer.longtailvideo.com/trac/wiki/Player5Events, the ViewEvent.JWPLAYER_VIEW_FULLSCREEN1 event can only be called from Actionscript. I need it to be from Javascript... Is there any way to achieve this? Can you recommend a better solution?

    Read the article

  • How can I find which process has opened a specific file?

    - by Hosam Aly
    How can I find which processes have a specific file opened, and their open, access and share modes? Additionally, is it possible to change these values for a process? Or is it even possible to open a file for reading if it is already opened for exclusive access by another process? Please note that I don't want to invalidate the handle of the process having the file opened. I just want to be able to access the file (if possible). (I'm mainly asking about Windows, but solutions for other platforms are welcome, since they contribute to the community's knowledge.) Edit: I found some answers for my first question here and there. Edit 2: Thanks everybody for the tools you mentioned, but I am mainly looking for programmatical techniques (e.g. using Win32 APIs).

    Read the article

  • Making two Windows using CreateWindowsEx() - 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! Edit: I've attempted to make a second window and although this does compile, no windows show atall on build. ////////////////////// // WINDOWS FUNCTION // ////////////////////// LRESULT CALLBACK WindowFunc(HWND hMainWindow, UINT message, WPARAM wParam, LPARAM lParam) { //Fields WCHAR buffer[256]; struct DiceData storage; HWND hwnd; // Act on current message switch(message) { case WM_CREATE: AddMenus(hMainWindow); hwnd = CreateWindowEx( 0, "ChildWClass", (LPCTSTR) NULL, WS_CHILD | WS_BORDER | WS_VISIBLE, 0, 0, 0, 0, hMainWindow, NULL, NULL, NULL); ShowWindow(hwnd, SW_SHOW); break; Any suggestions as to why this happens?

    Read the article

  • Vista/7: How to get glass color?

    - by Ian Boyd
    How do you use DwmGetColorizationColor? The documentation says it returns two values: a 32-bit 0xAARRGGBB containing the color used for glass composition a boolean parameter that is true "if the color is an opaque blend" (whatever that means) Here's a color that i like, a nice puke green: You can notice the color is greeny, and the translucent title bar (against a white background) shows the snot color very clearly: i try to get the color from Windows: DwmGetColorizationColor(dwCcolorization, bIsOpaqueBlend); And i get dwColorization: 0x0D0A0F04 bIsOpaqueBlend: false According to the documentation this value is of the format AARRGGBB, and so contains: AA: 0x0D (13) RR: 0x0A (10) GG: 0x0F (15) BB: 0x04 (4) This supposedly means that the color is (10, 15, 4), with an opacity of ~5.1%. But if you actually look at this RGB value, it's nowhere near my desired snot green. Here is (10, 15, 4) with zero opacity (the original color), and (10,15,4) with 5% opacity against a white/checkerboard background: So the question is: How to get glass color in Windows Vista/7? i tried using DwmGetColorizationColor, but that doesn't work very well. A person with same problem, but a nicer shiny picture to attract you squirrels: So, it boils down to – DwmGetColorizationColor is completely unusable for applications attempting to apply the current color onto an opaque surface. i love this guy's screenshots much better than mine. Using his screenshots as a template, i made up a few more sparklies: For the last two screenshots, the alpha blended chip is a true partially transparent PNG, blending to your browser's background. Cool! (i'm such a geek) Edit 2: Had to arrange them in rainbow color. (i'm such a geek) Edit 3: Well now i of course have to add Yellow. Undocumented/Unsupported/Fragile Workarounds There is an undocumented export from DwmApi.dll at entry point 137, which we'll call DwmGetColorizationParameters: HRESULT GetColorizationParameters_Undocumented(out DWMCOLORIZATIONPARAMS params); struct DWMCOLORIZATIONPARAMS { public UInt32 ColorizationColor; public UInt32 ColorizationAfterglow; public UInt32 ColorizationColorBalance; public UInt32 ColorizationAfterglowBalance; public UInt32 ColorizationBlurBalance; public UInt32 ColorizationGlassReflectionIntensity; public UInt32 ColorizationOpaqueBlend; } We're interested in the first parameter: ColorizationColor. We can also read the value out of the registry: HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM ColorizationColor: REG_DWORD = 0x6614A600 So you pick your poison of creating appcompat issues. You can rely on an undocumented API (which is bad, bad, bad, and can go away at any time) use an undocumented registry key (which is also bad, and can go away at any time) See also Is there a list of valid parameter combinations for GetThemeColor / Visual Styles API How does Windows change Aero Glass color? DWM - Colorization Color Handling Using DWMGetColorizationColor Retrieving Aero Glass base color for opaque surface rendering i've been wanting to ask this question for over a year now. i always knew that it's impossible to answer, and that the only way to get anyone to actually pay attention is to have colorful screenshots; developers are attracted to shiny things. But on the downside it means i had to put all kinds of work into making the lures.

    Read the article

  • GetEffectiveRightsFromAcl throws invalid acl error

    - by apoorv020
    I am trying to get the effective rights a user has on a file using interop in C#. Following is the code I am using : public static FileSystemRights GetFileEffectiveRights(string FileName, string UserName) { IntPtr pDacl, pZero = IntPtr.Zero; int Mask = 0; uint errorReturn = GetNamedSecurityInfo(FileName, SE_OBJECT_TYPE.SE_FILE_OBJECT, SECURITY_INFORMATION.Dacl , out pZero, out pZero, out pDacl, out pZero, out pZero); if (errorReturn != 0) { throw new Exception("Win error : " + errorReturn); } Program.TRUSTEE pTrustee = new TRUSTEE(); pTrustee.pMultipleTrustee = IntPtr.Zero; pTrustee.MultipleTrusteeOperation = (int)Program.MULTIPLE_TRUSTEE_OPERATION.NO_MULTIPLE_TRUSTEE; pTrustee.ptstrName = UserName; pTrustee.TrusteeForm = (int)Program.TRUSTEE_FORM.TRUSTEE_IS_NAME; pTrustee.TrusteeType = (int)Program.TRUSTEE_TYPE.TRUSTEE_IS_USER; errorReturn = GetEffectiveRightsFromAcl(pDacl, ref pTrustee, ref Mask); if (errorReturn != 0) { throw new Exception("Win error : " + errorReturn); } return (FileSystemRights)Mask; } This code works fine until I start modifying the ACL structure using the classes FileAccessRule and FileInfo, and then I start getting Windows Error 1336 : ERROR_INVALID_ACL. Same is the case if I debug the process call GetFileEffectiveRights once, pause the process,change the ACL through windows API, and resume and call GetFileEffectiveRights again(the 1st call succeeds but the second gives 1336.) What is going wrong?

    Read the article

  • Gui's with Win32 API

    - by user146780
    I'm wondering what the correct way of creating Gui's in with Win32 API. Right now I just call the CreateWindowEx in my WM_CREATE event, but I don't think this is the right way to do it. Just as an example, what would be the correct way of adding a 100x20 EditField and getting text from it? Would you create it on WM_Create then use GetText()? Thanks

    Read the article

  • Setting Application.Handle as a top-level window' owner

    - by Serg
    I want the main form to appear above some other application forms (in z-order), so I override CreateParams method for these forms as follows: procedure TForm3.CreateParams(var Params: TCreateParams); begin inherited; Params.WndParent:= Application.Handle; end; I know the Application.Handle was the top-level windows' owner before Vista (and Delphi 2007). What is wrong with it in Vista (and Windows 7)? What potential problems may arise if I set Application.Handle as a top-level window owner?

    Read the article

  • GetExitCodeProcess process termination status codes?

    - by Narcís Calvet
    Does anybody know where can I find a list of GetExitCodeProcess' process termination status codes? I've done some search in the internet and haven't been able to find one. I'm receiving a 33102 code from a GetExitCodeProcess call and I don't understand why. I hope getting a description for this error code will help me sorting this out.

    Read the article

  • Get country tld

    - by Pete Sampras
    Hello, How do I programmatically get the system country tld. In the registry there's a key called sCountry which has the country's name, but in the system language, eg. If the user has the Spanish version sCountry would be Espana, German version would be Deutschland, etc.

    Read the article

  • How do I use the Windows API Code Pack in VB.net 2010 Express?

    - by Josh
    Hi all, I recently downloaded the Windows API code pack for .net, and seeing there was VB.net examples inside there, I opened them up. Upon building I get a warning that the referenced components 'Core' and 'Shell' could not be found. Looking in the code pack folder I see there are no DLLs at all, but instead a whole load of C# sources. Do I have to download C# Express (which I want to avoid) to use the code pack or are there precompiled DLLs somewhere?

    Read the article

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