|
Would that code get what's in the rich edit good to know
I did find the bug in my code
What works in the debug version does not necessarily work in release by doing research the bugs have to do with the heap in my case I had forgotten to initialize CStatic *pointers after adding the '= new' code I resolved the problem thanks
|
|
|
|
|
I get this message all of the sudden while I have a modless Cdialog and Richedit displayed
When I switch the debugger to threads I see a number of ntdll.dll worker threads
Can somebody point me in the right path
Thanks
|
|
|
|
|
Just look at the Call Stack and find in this list your own (last called) module. Click on it to see what was your command/operation that caused the exception
|
|
|
|
|
I did that went to the main thread (and looked at the stack) it pointed to thrdcore.cpp
!::GetMessage(&(pState->m_msgcur line 155 Please note I have created 5 other Threads 4 UI threads which act as a wrappers for my Derived CAsynSocket Class and a regular worker thread
Thanks
|
|
|
|
|
Access violation means that you're accessing memory that hasn't been allocated to your application ... so do the obvious.
Go back a few steps on the stack and look at the sequence and look at all the pointer use and check
1.) The pointer is valid
2.) Is what it pointing at allocated
3.) If it is required that the structure it points to #0 terminated ... is it.
Something in the last calls is failing one of those criteria, if need separate every pointer to a temp line of code in those sections and run a debug test on it.
In vino veritas
|
|
|
|
|
Without some more information about where this happened, the code that caused it, and the values of the variables involved, it is impossible even to make any suggestions. The only thing one can say is that you are using either an uninitialised variable, or one that has received an invalid value.
|
|
|
|
|
The strange thing Is there all these worker threads (ntdll.dll) that seem to have come up okay
Thanks
|
|
|
|
|
ForNow wrote: all these worker threads (ntdll.dll) that seem to have come up okay But that does not mean anything. The only way to solve this sort of problem is by tracking back to the point where the fault is created. This may be a simple bug in your code, cross-thread corruption, or any one of a million other things happening.
|
|
|
|
|
If I put these two functions in a Windows program
/*-----*/
void SetTitle(HWND wn,char*S)
{SendMessage(wn,WM_SETTEXT,0,(long)S);}
/*-----*/
void GetTitle(HWND wn,char*S,long n)
{SendMessage(wn,WM_GETTEXT,n,(long)S);}
/*-----*/
these functions will set and read the window's title.
If I use these to catch the mouse interrupts:-
case WM_LBUTTONDOWN: case WM_LBUTTONUP: case WM_LBUTTONDBLCLK:
case WM_RBUTTONDOWN: case WM_RBUTTONUP: case WM_RBUTTONDBLCLK:
case WM_MBUTTONDOWN: case WM_MBUTTONUP:
case WM_MBUTTONDBLCLK: case WM_MOUSEMOVE:
{int x=short(L&0xffff),y=short(L>>16)&0xffff; char Z[64];
sprintf(Z,"{%d,%d,%2x}",x,y,S); SetTitle(wn,Z); goto DEF;}
the window's title will show the current mouse return values.
Please, what are the message names used to catch interrupts from a game-type joystick?, if I want to program for a joystick or similar.
|
|
|
|
|
|
The Windows functions still faithfully keep a return code (MK_MBUTTON = 16) for if the middle mouse button is down. Can computer mice with 3 buttons still be bought? Or have they gone where the passenger pigeon went?
|
|
|
|
|
This is hardly a question for a C++ forum? You can find different mouse types in any PC store.
|
|
|
|
|
Many mice have a scroll wheel which is also the middle button. If you have such a mice, just try to press the wheel instead of scrolling it.
So only the simplest / cheapest mice have only two buttons. Many even have more than three buttons nowadays.
|
|
|
|
|
print these numbers 6 28 66 in form of pyramid like
00006
00028 00066
|
|
|
|
|
1) Do not repost. You have already posted this homework question in the thread immediately below.
2) We do not do your homework. It's set to test what you know, not how good you are at getting strangers on the Internet to do your work for you.
Try it yourself, and you'll probably find it's not as difficult as you think. After all, it will be based on topics you've recently covered in your course.
If you're still stuck, then talk to your teacher.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
print these numbers 6 28 66 in form of pyramid like
00006
00028 00066
|
|
|
|
|
It's called string formatting and you want leading zeros
Here is the full reference
printf - C++ Reference[^]
Look at the sample with leading zeros ... which will be in your case you want 6 digits
printf ("Preceding with zeros: %06d \n", 6);
printf("Preceding with zeros: %06d \n", 28);
printf("Preceding with zeros: %06d \n", 66);
In vino veritas
|
|
|
|
|
Hereinafter, / should be backslash.
I am working on a recursive directory search function. It uses FindFirstFile, FindNextFile, WIN32_FIND_DATA info; , etc. It seems to work. If while working on directory X it comes across a subdirectory X/Y, it calls itself recursively to search the contents of directory X/Y (unless the directory's name starts with a fullstop). OK so far.
But, if the function recurses (say) 6 deep in a deep nest of directories, then the computer will have to keep tract of 6 FindFirstFile, FindNextFile, WIN32_FIND_DATA info; directory scan processes at once. Can I trust the computer to keep tract of all that lot at once and not trip over itself?
|
|
|
|
|
When you say "the computer", do you mean your application, or the windows system? If the former then only you can say; if the latter then: yes.
|
|
|
|
|
If the function recurses (say) 6 deep in a deep nest of directories, then each recursion level would have to keep track of a level of the directory tree, by a FindFirstFile, FindNextFile, WIN32_FIND_DATA info; directory scan process, all 6 at the same time. Can one application be trusted to run these 6 FindFirstFile, FindNextFile , WIN32_FIND_DATA info; directory-scans at once?
modified 29-Jul-16 17:58pm.
|
|
|
|
|
Anthony Appleyard wrote: Can one application be trusted to run these 6 FindFirstFile, FindNextFile , WIN32_FIND_DATA info; directory-scans at once? Well it isn't doing them all at once, it is doing them one at a time. If you are concerned about testing your application it is easy enough to create a structure to run your application on. But be aware of the limitations imposed by the MAX_PATH constant as described at FindFirstFile function (Windows)[^].
|
|
|
|
|
When the function is called again, all of the context information is pushed onto the stack and the new function call starts. When the function unwinds, the most recent context information is popped from the stack and the function picks up where it left off. This is all handled automatically by the system.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Im using this for the first time for mapping a function "f" with variable count of parameters
declarition:
template <class...A> void AllItemsO(void (*f)(A...), A... args)
{
}
call in cpp:
AllItemsO<IapVisibilityInfo*, IPickCookie*, MakeSubObjSpecial, AVHC(Object)&>(&IcompDWO3D::SetObjMat, visInfo, pci, doit, obj);
function to call is:
IcompDWO3D::SetObjMat
parameters:
visInfo, pci, doit, obj
compiler always shows up an error C2784
Fehler 1 error C2784: "void CapDWOICollection::AllItemsO(void (__cdecl *)(A...),A...)": template-Argument für "void (__cdecl *)(IapVisibilityInfo *,IPickCookie *,aprivis::MakeSubObjSpecial,aprivis::avhObjectWrapper &,A...)" konnte nicht von "void (__thiscall component::IcompDWO3D::* )(IapVisibilityInfo *,IPickCookie *,aprivis::MakeSubObjSpecial,aprivis::avhObjectWrapper &)" hergeleitet werden.
looking at what I have shown bold, it seems that it cannot spread the functionparameters form the A... variadic to single paarameters?
A non variadic verison with 2 Parameters looks like this and works:
template <class T1, class T2> void AllItemsO2(void (*f)(T1, T2), T1 p1, T2 p2)
{ for (auto _F : *this) if (_F) ((_F)->*f)(p1, p2); }
any help for my syntax?
|
|
|
|
|
I've got this the following code snippets... when compiling, I kept on getting error: implicit declaration of function. This "eeprom_memory_update_byte" came from avr/eeprom.h. What I am trying to update the atmel processor eeprom memory (not write, but to update)
In commands.c (in a function):
bool Update_EEPROM_Memory_byte(byte val1, byte val2)
{
uint8_t eepromAddr = val1;
uint8_t eepromVal = val2;
eeprom_memory_update_byte(eepromAddr, eepromVal);
return 1;
}
In eeprom.h
void eeprom_update_byte (uint8_t *__p, uint8_t __value);
In eeprom.c
bool eeprom_memory_update_byte(uint8_t eeprom_addr, uint8_t eepromValue)
{
eeprom_update_byte((uint8_t*) eeprom_addr, eepromValue);
uint8_t eepromVal = eeprom_read_byte(( uint8_t *) eeprom_addr);
if (eepromValue == eepromVal)
return 1;
else
return 0;
}
please help!
|
|
|
|
|
The first parameter in eprom_update_byte() function declaration is different than what is the the implemntation. In the .h file it is a pointer to a uint8_t (uint8_t *__p), and in the implementation it is a copy of the object (uint8_t eeprom_addr) passed by value. I'm guessing, change the implementation line in the .c file. But that might cause you to call the function differently like,
eeprom_memory_update_byte(&eepromAddr, eepromVal);
|
|
|
|