Search Results

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

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

  • Maximum Possible File Name Length in Windows Kernel

    - by Lambert
    I was wondering, what is the longest possible name length allowed by the Windows kernel? E.g.: I know the kernel uses UNICODE_STRING structures to hold all object paths, and since the byte length of a wide-character string is stored inside a USHORT, that allows for a maximum path length of 2^15 - 1 characters. Is there a similar, hard restriction on a file name (rather than path)? (I don't care if NTFS or FAT32 imposes a particular restriction; I'm looking for the longest possible theoretically allowed name in the kernel, assuming no additional file system or shell restrictions.) (Edit: For those wondering why this even matters, consider that normally, traversing a directory is achieved by FindFirstFile/FindNextFile calls, one call per file. Given the function named NtQueryDirectoryFile, which is the underlying system call and which returns multiple file names per call, it's actually possible to take advantage of this maximum-length restriction on the path to make an extremely-fast directory traverser that uses solely the stack as a buffer. Now I'm trying to extend that concept, and I need to know the maximum size of a file name.)

    Read the article

  • Is there a way to programatically check dependencies of an EXE?

    - by Mason Wheeler
    I've got a certain project that I build and distribute to users. I have two build configurations, Debug and Release. Debug, obviously, is for my use in debugging, but there's an additional wrinkle: the Debug configuration uses a special debugging memory manager, with a dependency on an external DLL. There's been a few times when I've accidentally built and distributed an installer package with the Debug configuration, and it's then failed to run once installed because the users don't have the special DLL. I'd like to be able to keep that from happening in the future. I know I can get the dependencies in a program by running Dependency Walker, but I'm looking for a way to do it programatically. Specifically, I have a way to run scripts while creating the installer, and I want something I can put in the installer script to check the program and see if it has a dependency on this DLL, and if so, cause the installer-creation process to fail with an error. I know how to create a simple CLI program that would take two filenames as parameters, and could run a DependsOn function and create output based on the result of it, but I don't know what to put in the DependsOn function. Does anyone know how I'd go about writing it?

    Read the article

  • Can not get msconfig .exe to run in the system32 folder shellexecute Delphi

    - by grant1842
    Im on Win 7 64b. Im trying to run msconfig from my delphi app. The msconfig.exe file is in the system32 folder . I copied the msconfig.exe to the c:\ and it works great. This looks like some kind of permission issue. var errorcode: integer; begin errorcode := ShellExecute(0, 'open', pchar('C:\Windows\System\msconfig.exe'), nil, nil, SW_NORMAL); if errorcode <= 32 then ShowMessage(SysErrorMessage(errorcode)); end; Has anyone seen this and figured out how to run the msconfig.exe from the sys32 .

    Read the article

  • Windows API geting HWND

    - by Stacker
    im developing a piece of software to inset some text in a richedit of another program the code goes like this : atlfe = FindWindowEx(wtlsplitterwindow, 0, "atl:0087d7a8" , null); this is only one line: this works fine , problem is with every release of the program this number ""atl:0087d7a8" changes so i have to use spy++ to get the new one and change it in the code. the question is , is there is any way i can get that number from code? by the way im using C#, vs2010 thanks.

    Read the article

  • How to remove the MenuBar of an application using windows API ?

    - by karthik
    I am using the below code to remove the Title Bar of an application, which is working perfectly for notepad. Now i want to remove the Menu Bar also. How to achieve it ? //Finds a window by class name [DllImport("USER32.DLL")] public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); //Sets a window to be a child window of another window [DllImport("USER32.DLL")] public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); //Sets window attributes [DllImport("USER32.DLL")] public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); //Gets window attributes [DllImport("USER32.DLL")] public static extern int GetWindowLong(IntPtr hWnd, int nIndex); [DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)] static extern IntPtr FindWindowByCaption(IntPtr ZeroOnly, string lpWindowName); //assorted constants needed public static int GWL_STYLE = -16; public static int WS_BORDER = 0x00800000; //window with border public static int WS_DLGFRAME = 0x00400000; //window with double border but no title public static int WS_CAPTION = WS_BORDER | WS_DLGFRAME; //window with a title bar public void WindowsReStyle() { Process[] Procs = Process.GetProcesses(); foreach (Process proc in Procs) { if (proc.ProcessName.StartsWith("notepad")) { IntPtr pFoundWindow = proc.MainWindowHandle; int style = GetWindowLong(pFoundWindow, GWL_STYLE); SetWindowLong(pFoundWindow, GWL_STYLE, (style & ~WS_CAPTION)); } } }

    Read the article

  • Access denied from another thread

    - by Lobuno
    Hello! In a program I span a thread ("the working thread"). Hera I copy some files write some data to a database and eventually, delete some other files or directories. Everything works fine. The problem is now, that I decided to move the deleting operation to some other thread. So the working thread now copies the files or directories, writes to the database, and , if there is a need to delete some other files this thread spans another thread and that second thread deleted the needed files or directories. The problem is that,the deletion used to work 100% when done in the working thread, now when the same is done in the secondary thread, I sometimes get an "Access denied" error and the files cannot be deleted. And no, the working thread is definitely NOT acceding the files and directories to delete at this moment. Sometimes (but not always) the main thread is impersonating some user, so if needed , the deleting thread is also running under impersonation just to grant the needed permissions to delete the files, so that should not be the problem. Anybody has a clue why this could be happening?

    Read the article

  • Low-level Keyboard Hooks/SendInput with Winkey+L possible? (workstation lockout is intercepted in Vi

    - by Brian Jorgensen
    I work on a project called UAWKS (Unofficial Apple Wireless Keyboard Support) that helps Windows users use Apple's bluetooth keyboard. One of the main goals of UAWKS is to swap the Cmd key (which behaves as Winkey in Windows) with Ctrl, allowing users to do Cmd+C for copy, Cmd+T for new tab, etc. It is currently developed using AutoHotkey, which worked pretty well under Windows XP. However, on Vista and Windows 7, Cmd+L causes problems: Regardless of low-level keyboard hooks, Winkey+L is always intercepted by Windows and normally locks the workstation... You can disable workstation locking with this registry hack, but pressing Winkey+L still can't be rebound in AHK Pressing Winkey+L leaves Winkey in the Keydown state until the next (additional) Winkey Up. Simulating a Keyup event doesn't seem to work either! It seems that Winkey+L is a special chord that messes everything else up. I've looked through the AHK source code, and they try to address this problem in SendKey() in keyboard_mouse.cpp (near line 883 in v1.0.48.05), but it doesn't work. I wrote up my own low-level keyboard hook application in C#, and I see the same problem. Has anyone else run into this? Is there a workaround?

    Read the article

  • Why would MessageBox fail silently?

    - by Tim Gradwell
    Does anyone know how MessageBox(...) could fail silently? MessageBox(g_hMainhWnd, buffer, "Oops!", MB_OK | MB_ICONERROR); ShellExecute(0, "open", "http://intranet/crash_handler.php", NULL, "", SW_SHOWNORMAL); For a little context, this code is called inside our own exception handler, which was registered with SetUnhandledExceptionFilter() Most of the time, I see the message box, and then it launches a web browser. However, I have an exe, which as far as I'm aware uses this exact code, and it successfully launches the web browser, but I do not see the message box first. Thanks Tim

    Read the article

  • Get newly created window using Win32 API hooks

    - by Nathan W
    This may be a long short or not even possible but no harm in asking. What I am trying to do is monitor an application for any new windows it creates in its MDI control. I have implemented hooking in C# and can capture the MDICREATE window message but because I need to get information about the window after is has been created the MDICREATE message isn't much help because at that stage the window hasn't been created in the other application yet. Without going into to much detail I just need to be able to see when a new window has been created. Is this possible? Thanks

    Read the article

  • How can I make another application's window transparent?

    - by Sil
    I know how to make my own application transparent using Layered Windows but I want to make a different application transparent (for example notepad). I wrote code like this but it doesn't work with other windows except my app main window: SetWindowLongPtr(WindowFromPoint(p), GWL_EXSTYLE, GetWindowLongPtr(hWnd, GWL_EXSTYLE) | WS_EX_LAYERED); SetLayeredWindowAttributes(WindowFromPoint(p), 0, (255 * 50) / 100, LWA_ALPHA); where p is a point on screen ( for example the window I select with my mouse ) I am also interested if there is a way to do this directly from Windows 7 (not necessarily programmatic). I figure there must be a way to do it since every application is rendered in it's own surface and DWM composites them into the final image.

    Read the article

  • SetParent() on a VB6 application from a C# app

    - by JD
    Aloha all! I am trying to use the win32 API to set the parent of an application to a panel in my C# application. I can get most applications to work... However I have one application which was written in VB6 which I am having problems with... When I inspect it using spy++ the application loads in 2 main forms 'ThunderRT6Main' and 'ThunderRT6MDIForm' both with the same title. I have found the handle of both of these and tried to call SetParent on them both but the window does nothing and does not move anywhere... Is there something funky I need to do when invoking SetParent() on a VB6 app?

    Read the article

  • MFC/CCriticalSection: Simple lock situation hangs

    - by raph.amiard
    I have to program a simple threaded program with MFC/C++ for a uni assignment. I have a simple scenario in wich i have a worked thread which executes a function along the lines of : UINT createSchedules(LPVOID param) { genProgThreadVal* v = (genProgThreadVal*) param; // v->searcherLock is of type CcriticalSection* while(1) { if(v->searcherLock->Lock()) { //do the stuff, access shared object , exit clause etc.. v->searcherLock->Unlock(); } } PostMessage(v->hwnd, WM_USER_THREAD_FINISHED , 0,0); delete v; return 0; } In my main UI class, i have a CListControl that i want to be able to access the shared object (of type std::List). Hence the locking stuff. So this CList has an handler function looking like this : void Ccreationprogramme::OnLvnItemchangedList5(NMHDR *pNMHDR, LRESULT *pResult) { LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR); if((pNMLV->uChanged & LVIF_STATE) && (pNMLV->uNewState & LVNI_SELECTED)) { searcherLock.Lock(); // do the stuff on shared object searcherLock.Unlock(); // do some more stuff } *pResult = 0; } The searcherLock in both function is the same object. The worker thread function is passed a pointer to the CCriticalSection object, which is a member of my dialog class. Everything works but, as soon as i do click on my list, and so triggers the handler function, the whole program hangs indefinitely.I tried using a Cmutex. I tried using a CSingleLock wrapping over the critical section object, and none of this has worked. What am i missing ?

    Read the article

  • Which accessType should I use when calling InternetOpen?

    - by Colen
    According to the MSDN, you can specify an access type parameter to InternetOpen. Two of the options for the dwAccessType parameter are: INTERNET_OPEN_TYPE_DIRECT - Resolves all host names locally. INTERNET_OPEN_TYPE_PRECONFIG - Retrieves the proxy or direct configuration from the registry. Which of these should I use? I don't know which would be "better". We don't want our application to do anything clever, all we want it to do is access the internet in a normal way.

    Read the article

  • How to obtain the first cluster of the directory's data in FAT using C# (or at least C++) and Win32A

    - by DarkWalker
    So I have a FAT drive, lets say H: and a directory 'work' (full path 'H:\work'). I need to get the NUMBER of the first cluster of that directory. The number of the first cluster is 2-bytes value, that is stored in the 26th and 27th bytes of the folder enty (wich is 32 bytes). Lets say I am doing it with file, NOT a directory. I can use code like this: static public string GetDirectoryPtr(string dir) { IntPtr ptr = CreateFile(@"H:\Work\dover.docx", GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0,//FILE_FLAG_BACKUP_SEMANTICS, IntPtr.Zero); try { const uint bytesToRead = 2; byte[] readbuffer = new byte[bytesToRead]; if (ptr.ToInt32() == -1) return String.Format("Error: cannot open direcotory {0}", dir); if (SetFilePointer(ptr, 26, 0, 0) == -1) return String.Format("Error: unable to set file pointer on file {0}", ptr); uint read = 0; // real count of read bytes if (!ReadFile(ptr, readbuffer, bytesToRead, out read, 0)) return String.Format("cant read from file {0}. Error #{1}", ptr, Marshal.GetLastWin32Error()); int result = readbuffer[0] + 16 * 16 * readbuffer[1]; return result.ToString();//ASCIIEncoding.ASCII.GetString(readbuffer); } finally { CloseHandle(ptr); } } And it will return some number, like 19 (quite real to me, this is the only file on the disk). But I DONT need a file, I need a folder. So I am puttin FILE_FLAG_BACKUP_SEMANTICS param for CreateFile call... and dont know what to do next =) msdn is very clear on this issue http://msdn.microsoft.com/en-us/library/aa365258(v=VS.85).aspx It sounds to me like: "There is no way you can get a number of the folder's first cluster". The most desperate thing is that my tutor said smth like "You are going to obtain this or you wont pass this course". The true reason why he is so sure this is possible is because for 10 years (or may be more) he recieved the folder's first cluster number as a HASH of the folder's addres (and I was stupid enough to point this to him, so now I cant do it the same way) PS: This is the most spupid task I have ever had!!! This value is not really used anythere in program, it is only fcking pointless integer.

    Read the article

  • Correct (pretty) window redraw during the creation

    - by Coder
    Does anyone know what is a correct way to redraw window during lengthy initialization operations? Say I have HWND with NULL brush, and it does some not so quick child window initialization (Window initialization is not so quick on Vista and 7, especially on netbooks, even with threaded app). With this config window stays black for half a second on slower laptops. But if I supply window color brush, it seems that there are some sort of child controls or something that draws black squares on top of it, which also seems ugly. Even though the controls are created without WS_VISIBLE initially. Oh, the window has the WS_EX_COMPOSITED style, which should do the double buffering to avoid flicker. But it still behaves ugly. Are there any other tricks I've forgotten, missed?

    Read the article

  • Finding a handle that persists when relaunching parent

    - by cidtek
    I need to interact with 3'rd party applications by knowing the handle of certain text fields, but the hWnd always changes when that window is recreated. Is there any method that would allow me to identify a window and repeatedly be able to access that window (even after it is closed and then reopened) without having the user manually identify the window? I need the user to be able to identify a window with the usual click, drag and release method but only have to do it once and not every time the target window is recreated.

    Read the article

  • Writing to the middle of the file (without overwriting data)

    - by Andreas Bonini
    In windows is it possible through an API to write to the middle of a file without overwriting any data and without having to rewrite everything after that? If it's possible then I believe it will obviously fragment the file; how many times can I do it before it becomes a serious problem? If it's not possible what approach/workaround is usually taken? Re-writing everything after the insertion point becomes prohibitive really quickly with big (ie, gigabytes) files. Note: I can't avoid having to write to the middle. Think of the application as a text editor for huge files where the user types stuff and then saves. I also can't split the files in several smaller ones.

    Read the article

  • Decompiling an old Program

    - by Pedro Laranjeiro
    Hi. I have been asked to update a program written in 1987 in Delphi (I guess). I have no documentation about this program only a few side notes the programmer took that don't make too much sense to make. The cd show this files: Size | Filename - 19956 VP.DTA - 142300 VP.LEX - 404 VP.NDX - 126502 VP.RCS - 131016 VP.SCR - 150067 VP.XEL - 101791 vp.exe Is anyone of this files a database? If so can I access it's data? I tried several code decompilers but they show a message saying it was not a Win32 compatible application. The program run in MS-DOS. Is it possible to obtain the source code? Can I use this code in any way to build a new application? Thanks Update01: I can run the program in MSDOS. The program conjugate verbs and shows an example sentence where the verb can be used. The GUI is a little bit confusing and there is no help menu so I can't see all the capabilities of the program.

    Read the article

  • Windows Power State change event notification in Qt

    - by Surjya Narayana Padhi
    Hi Geeks, I developing a GUI in QT where I have to show the battery status icon. To get the system power status, I am using the windows API. But to show status anytime , do i need to use a thread to continuously read and display the power status? I am thinking of using event handler. But not sure how to implement. I am thinking that for just one status icon I will run a thread. Anybody has any better suggestion, please share.

    Read the article

  • Using CreateFileMapping between two programs - C

    - by Jamie Keeling
    Hello, I have two window form applications written in C, one holds a struct consisting of two integers, another will receive it using the CreateFileMapping. Although not directly related I want to have three events in place so each of the processes can "speak" to each other, one saying that the first program has something to pass to the second, one saying the first one has closed and another saying the second one has closed. What would be the best way about doing this exactly? I've looked at the MSDN entry for the CreateFileMapping operation but I'm still not sure as to how it should be done. I didn't want to start implementing it without having some sort of clear idea as to what I need to do. Thanks for your time.

    Read the article

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