|
It sounds like you are trying to write in the title bar of the window - is that right? The easy way is to call SetWindowText() on the dialog box HWND (or do whatever the MFC equivalent is) and let the default dialog proc handle drawing your text.
Otherwise you would have to draw in the non-client area, which has its own WM_NCPAINT message to handle.
|
|
|
|
|
thanks I choose the later NC_CLIENT might I ask you a few follow up questions 1) is there a way to determine the NC area,like GetWindowNCRect. In Additon TextOut is giving me issues would I be better off using DrawText would it need to be preceded by DrawCaption
Not sure as
if you could steer me the right direction would appreciate it
|
|
|
|
|
WriteFile return access denied?
while i providing admin privileges
please help me for this.
HANDLE hCD = CreateFile (file_Name, GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
NULL);
WriteFile (hCD, Buffer, Size, &bytesWritten, NULL);
its fails with access denied.
thanks in advance.
|
|
|
|
|
Check the file name and make sure that it is where you think it is, and is not protected against write access.
|
|
|
|
|
i chk all is ok n its not write protected at all....
now what can i do
|
|
|
|
|
Sorry, it is impossible to tell what may be the problem without access to your system.
|
|
|
|
|
I just tried your actual code on my system and it works fine, so the problem must definitely be something to do with the file or its location.
|
|
|
|
|
its my card storage connected on usb 3.0 port
on usb 2.0 its working fine
|
|
|
|
|
You need to check in Settings to make sure it is accessible. You can try a simple copy from File Explorer as a start.
|
|
|
|
|
Two things
First you are a person which has specific access to the file system.
Your application is not you. The access it has depends on how it runs.
You as a person are likely checking the access but that does not mean the application has it.
Second the directories also determine access.
You can programmatically request information about permissions. Write some code that returns that information from EACH level of the directory tree including the drive letter. Then inspect that.
|
|
|
|
|
I have a very simple project that I am converting from VS2015 to VS2019. The project "converts" successfully but will not compile due to:
"fatal error C1189: #error: MFC does not support NTDDI_VERSION less than NTDDI_WINXP. Please change the definition of NTDDI_VERSION in your project properties or precompiled header."
I've turned off precompiled headers and added to my stdafx.h the following line:
#define NTDDI_VERSION 0x0A00
I've also tried
#define NTDDI_VERSION _WIN32_WINNT_WIN10
stdafx.cpp will not compile. So, my question stands - is there a method to determine all of the project macro settings?
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
Solved - ignore all of the online garbage.
create a dummy VS2019 application. There you will see that Microsoft has migrated to using targetver.h which includes:
#include <sdkddkver.h>
That's the secret.
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
Hi Charlie,
Good to see that you fixed your issue. Just in case the search engines index this question I wanted to add that you can use the /P compiler option[^] to dump the preprocessor to file.
Best Wishes,
-David Delaune
|
|
|
|
|
Thanks for that tip. Exactly what I was looking for.
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
Hello, I'm a begginer in Golang and I need a good IDE for my exercises. Anyone can help me with a good IDE and how to install? Thank you very much.
|
|
|
|
|
|
I`m trying to get a better understanding of how debugging works with programs build in an IDE. I have a guess on how it works but I`m hopping someone will confirm my guesses. So my guess is that the program your building it hooked through its update function (the function through which it gets updated by windows). When your run your program in debug mode the changes taking place inside your program are exchanged through the program update function as parameters with Windows which in its turn sends the data to the IDE.
|
|
|
|
|
A Debug version of a program includes information that an external program (the debugger) can read, in order to identify which actual statement is being executed at any point in time. The debugger captures the execution at the beginning of the program or at any specified breakpoints, and can then execute or skip instructions as directed by the user. The debugger can be run from within the IDE, or stand-alone in a terminal window, depending on the system and framework in use. When run in the IDE it is just using the IDE Windows to display information.
|
|
|
|
|
So basically the program being debugged is a sitting duck residing in the memory that an external program can read at will/without any formalities.
|
|
|
|
|
Not at all, since you, the user, are in control of the system and what application are running and what they are allowed to do. And Debug information is not a simple text file that anyone can immediately interpret.
|
|
|
|
|
|
The really low level implementation may vary a lot.
A couple variants I have worked with:
To halt execution temporarily, e.g. an explicitly declared breakpoint, or implicit by e.g. a 'continue to next line', the debugger looks up the address of the first instruction generated for that source line in the debug information. It copies and saves the first instruction, and inserts a special breakpoint instruction. Most modern CPUs provide a specific instruction, generating an internal interrupt, causing exeution of an interrupt handler provided by the debugger. Also, most modern CPUs have a mechanism for executing a single instruction and then cause a similar internal interrupt. And, the handlers are run at a low priority so that a higher priority interrupt, e.g. the clock, may preempt the debugger interrupt handler to let other processes have their CPU share.
The debugger user dialog (e.g. to continue exectution, remove the breakpoint, display the current value of some variable etc.) takes place within this interrupt handler. When target execution is resumed, the debugger backs up the program counter to the start of the breakpoint instruction it has inserted, puts the saved "real" instruction into the code, sets the 'single instruction' flag to the CPU, and returns from the debug interrupt.
The single instruction interrupt reinserts the breakpoint instruction, ready for the next time execution passes through this point in code. It resets the single instruction flag and returns from interrupt, and target execution continues until the next breakpoint.
For 'run to next line', the debugger may find the first instruction of every relevant line in the code (usually limited to the current function and the continuation point upon return, but exception handlers may complicate this) and save all the instructions being overwritten. When any of the breakpoints are hit, the same restore-original / single step / reinsert breakpoint procedure is followed. The breakpoints remain until that scope is left, i.e. when the function is exited. The handler for that interrupt will restore all the original code, and then set breakpoints on all line starts in the new scope. Also if another function is called and another scope is entered, the debugger must set breakpoints in that scope.
In the old days when memory was scarce, setting a huge number of line start breakpoints and saving information for each of them would break all memory limits. So when halted at one line, as the single current breakpoint, the debugger would look up the start of every possible next line - one for linear execution, one for a line containing a function call, two for a conditional statement, ... Whichever of them were hit next, the debugger would restore the original code for them all, and repeat the search for possible next lines. This reduced debugger memory requirements a lot, but for every single line, the debugger had to do a possibly complex search for possible next lines.
Older machines might not provide a breakpoint instruction. I have seen it emulated by the OS - all machines have some internal interrupt mechanism for calling OS functions. So rather than a breakpoint instruction, the debugger inserts a breakpoint OS call. The OS will transfer control to the process that has registred itself as the debugger for the target process. On old machines with a small virtual adddress space, there might not be room for both the target and the debugger in one space, so to inspect current values in the target, the debugger might have to request the OS to provide it. So it must also ask the OS to please insert a breakpoint call in the target process at a specific address.
A small variation of that: One debugger injected a tiny routine - a few hundred bytes - in the target process. This routine could be contated over a TCP/IP connection from virtually anywhere, and could on request set and remove breakpoint instructions, return or set the current value of variable etc., at a purely binary level: The remote debugger provided absolute addresses for all operations by the routine. Since all symbol handling etc. was done at the remote debugger machine, the impact on the target system was almost zero both in CPU and memory consumption.
Inserting breakpoints (whether as instructions or as OS calls) is not possible in code in ROM, and in many cases not a viable solution if code is in flash memory. So some processors (typially targeted at embedded systems, where ROMmed/flashed code is common) provide a set of registers: Whenever the program counter is set to the value of one of these registers (with no modifications to program code), a debug interrupt is generated. The debugger need not restore any original instruction (or debug instruction after executing the original), but is limited to, say, four breakpoint locations active at the same time. For 'run to next line' operation, there is no alternative to search the debug information for possible next lines. If the number of possibilities is larger than debug registers available, it must resort to instruction-at-a-time exeution through the current line, an when the program counter goes out of the scope of the current line, use the debug information to see where it ended up, and give control to the debugger operator.
You may conclude that writing the core of a debugger is not a task you would give to a college freshnman. It really requires fingertip control over interrupts and addressing and instruction formats!
|
|
|
|
|
Does AddVectoredExceptionHandler only run in debug, I just rebuilt my code in Release and it entered the SEH routine when I comment it out I dont have a problem
Thanks
|
|
|
|
|
|
I guess the best thing to do is determine what the exception record pints to
Thanks
|
|
|
|
|