|
The details of your current problems can only really be fixed by you and a debugger.
Have a look at the code around the ASSERT - is it complaining that your calling UpdateData on a window that hasn't even been created yet? But if that's true, how can you get a button to be clicked unless it's on a valid window / dialog. Unless you are calling this method manually...
Which you say you are. At what point do you call the above function? Is it's before you have all the windows created, you'll be in trouble.
Etc.
You need to litter your code with breakpoints, and keep a very close eye on the m_hWnd member of your dialog and controls.
Iain.
|
|
|
|
|
you're right about that, the problem seems to be unique to this situation.
I am calling this function AFTER the tabs are created.
for whatever reason, the value passed to the function in wincore.cpp(just above line 4184) is a 1 when the error occurs, which suggests the data is being transfered from Screen/Dialogue to memory, while I am expecting it to go from memory to Screen.
But Thanks for the inputs....
Best regards
RV
|
|
|
|
|
UpdateData (BOOL bSaveAndValidate = TRUE)
It's not a spooky coincidence - you are calling it with true, which says "take values from screen, and put them into my variables".
But the other window creation stuff remains.
Iain.
|
|
|
|
|
The GetPrivateProfileString function strips leading whitespace. Is there an overload that doesn't, or will I have to write my own?
eg
[Example]
SomeValue=" foo bar baz"
(not code, but needed to preserve spacing)
I want to get the 6 leading spaces in front of foo in the buffer.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
I believe this is by design of the ini "language"...
not sure, but i don't think you can have it without coding some stuff from your own...
|
|
|
|
|
I suspect toxxct is correct. But you may be able to get past the issue by using a special character (ie, '_') to replace the spaces.
Or maybe more cleverly, use UrlEscape function to replace spaces with %20, etc, and UrlUnescape to convert back again.
Iain.
|
|
|
|
|
I ended up using the former approach. UrlEscape probably would work as well, but would more significantly impact the ability of a user to edit the file.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
I build the dll that having a global variable. my requirement is to load the dll in
same application many times . every thing is fine but problem is that global variable using
copy the same value in all instances . how to avoid it . I must need that global variable.
Ashish
|
|
|
|
|
See here [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
Here's a solution I got from led mike: Use a class with a static member variable. It will be the same variable for all DLL instances.
|
|
|
|
|
I can't believe it.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
As I recall led mike's suggestion solved a problem I had been working on for hours. It makes sense; the linker resolves external references, and all references to a static class member should resolve to the same address.
|
|
|
|
|
Alan Balkany wrote: It makes sense; the linker resolves external references, and all references to a static class member should resolve to the same address.
It does NOT make sense, all references to a static class member should resolve to the same address only inside the same memory space (i.e. the same process). Of course this is going on my arrogant assumptions...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
But when the different instances of the DLL are linked, aren't they in the same process? (When you call a method in a DLL, it doesn't automatically start another process to do this.)
|
|
|
|
|
Well, maybe I've misunderstood. I thought the OP was talking about multiple instances of the same application (i.e. different processes) and not multiple instances of the same DLL inside the same process. BTW what is the point of loading the same DLL multiple times?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
So, you're attempting to re-load the same DLL multiple times, in the same process?
But you want them to act independently?
And, in your case, the global variable isn't doing that -- it's the same each time?
Is that what you are asking?
I think that the deal is -- you can't load the same DLL multiple times within the same process.
The answer you seek?
Get rid of the global variable in the DLL and find another way to accomplish what it accomplishes.
?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
Hi all,
I m working on SDI type application,use splitter to divede view in two parts.
at any time all application are not responding and all area is black.
if i click any other position than this error comes.
Unhandled exception at 0x00507ebe in Employee Planner.exe: 0xC0000005: Access violation reading location 0x00000050.
if i use break option than it point out at this location ::
in winocc.cpp
DWORD CWnd::GetExStyle() const
{
ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));
if (m_pCtrlSite == NULL)
return (DWORD)GetWindowLong(m_hWnd, GWL_EXSTYLE);
else
return m_pCtrlSite->GetExStyle();
}
i dont know wat its is please tell me what can i do.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Here ? ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));
Something is really wrong. Your window doesnt exist!!! Check the object!!
Greetings from Germany
|
|
|
|
|
Hi all,
I am getting seg fault when trying this piece of code.
I'm not getting what is went wrong here.
void fun(int* ptr){
ptr = (int*)malloc(sizeof(int));
}
int main(){
int *ptr = NULL;
fun(ptr);
*ptr = 5; //seg fault
cout<<*ptr;
}
|
|
|
|
|
Well of course, you are passing a pointer to a function (a certain address, which is NULL). In the function, you assign a new address to this pointer but the pointer is only a copy of the original, so, your original pointer is not affected. To make things more easier, think that a pointer is just a variable that holds an address. When you pass this variable to a function, the function makes a copy of it. It still points to the same address but if you change the address, you only modify the local copy.
|
|
|
|
|
ok
then what change is required here. so that i can i can put some value into memory allocated in fun() function.
|
|
|
|
|
Exactly the same as if it was a variable: pass it by reference.
|
|
|
|
|
Like this???
void fun(int* ptr){
ptr = (int*)malloc(sizeof(int));
}
int main(){
int ptr;
fun(&ptr);
ptr = 5;
cout<<ptr;
}
I dont think so..
probably you mean something else.. that i am not getting.
modified on Monday, September 29, 2008 8:40 AM
|
|
|
|
|
Use &.
void fun(int*&ptr)
{
}
then in the main function
fun(ptr)
Is it working now?
modified 7-Mar-17 16:31pm.
|
|
|
|