|
My name is BIKRAM, dude.
While I can, possibly, with difficulty, attempt to find out the keypath from a handle-value, its not worth the trouble.
It seems you have either a design problem or are attempting to intercept a function call from a process. In either case, you will need to re-think your strategy. I could help you in this, but i do knot know exactly what you want to accomplish and why.
Bikram Singh
|
|
|
|
|
Hi friends,
I am trying to devlop a Single Document (Document/View Architecture) MFC application, which has Three frames. Left frame has a Hierarchy tree and on selection of any leaf node, number (not fixed) of images be displayed on the right upper frame (four picture per row) dynamically as shown below.
---------------------------------------
| | |
| | |
| Tree | Images |
| | |
| | |
| |-----------------------------
| | |
| | Discription |
| | |
--------- -----------------------------
On click of an image its description should be displayed in right lower frame
My first priority is to display images dynamically.
Example: when there are 10 images, it should display 4 in first row, 4 in second row and last 2 in third row.
If any material/example/sample code/suggestion, Please reply me.
I need it very argently. Please help me.
Thanx
|
|
|
|
|
You might want to search for thumbnail in the MFC/C++-articles, I got 4 hits. You will most probably get a few good ideas there.
|
|
|
|
|
Thanx Johan.
I got some usefull info from the search.
In deed I was looking for similar which I got in search.
Thanx again
|
|
|
|
|
Hi,
In .NET the class view , resource view etc can be docked on the left hand side of the screen and then
when the mouse hovers over them they jut out and can be viewed. Does anyone have an example of how this could be implemented ?
Thankyou,
flip
|
|
|
|
|
1. I have a class that, due to some restrictions, can be instantiated only once at any one time. I was thinking of doing that by using a global variable (I know it's bad...), the code might look like this:
A::A()
{
if(GLOBAL_A_INSTANTIATED > 0)
{
delete this;
return;
}
GLOBAL_A_INSTANTIATED = 1;
.....
.....
}
A::~A()
{
GLOBAL_A_INSTANTIATED = 0;
}
my concern is, how about auto-variables that are instantiated without the new operator? Will this work?
Or are there any better solutions other than using a global variable?
2. Should I declare my member variables that will be updated by a callback function as volatile?
Thanks!
|
|
|
|
|
Indrawati wrote:
my concern is, how about auto-variables that are instantiated without the new operator? Will this work?
Yes, it would work the same as for instanced instantiated using the new operator.
Indrawati wrote:
Or are there any better solutions other than using a global variable?
You could use a static data member in the class. Or use some Windows-specific technique like creating a mutex with a unique name.
Indrawati wrote:
2. Should I declare my member variables that will be updated by a callback function as volatile?
You dont really need to use the volatile keyword unless you are using multiple threads..
Bikram Singh
|
|
|
|
|
Hi
Thanks for the reply.
I have searched the net for some more information, but according to C++ FAQ Lite, delete this must not be invoked on local objects which are allocated on the stack (http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.14), so I guess that means I can't do that on auto-variable, can I?
And regarding the 2nd question, if the callback function is called by another thread, I have to declare the variable as volatile, right?
Thanks!
|
|
|
|
|
Oops, sorry i didnt notice the 'delete this' is your code earlier.
Calling delete this for a stack-based object will cause an exception, because the stack cannot be "freed" until a function returns.
If you are using this technique in your code, you should not be using stack-based objects at all.
Consider this:
void First(void)<br />
{<br />
MyClass a;<br />
}<br />
<br />
void Second(void)<br />
{<br />
MyClass b;<br />
First();<br />
}
In this scenario, how would you prevent the second stack-based object being created in the call to First() ?
For this reason, either you should only use object instantiation via the new operator, or use some a BOOL data member to disable unwanted-instances' functionality. The latter is ofcourse tedious, and prone to errors.
You could, throw an execption in the constructor when you detect that a class instance is not the first instance.
Then, in every place you use this class via stack/freestore, you could use exception handling.
Bikram Singh
|
|
|
|
|
Anonymous wrote:
And regarding the 2nd question, if the callback function is called by another thread, I have to declare the variable as volatile, right?
Yes, you should declare the variable as volatile. Also, note that if you declare a struct to be volatile, all it's members are automatically made volatile.
Bikram Singh
|
|
|
|
|
Would a Singlton work for you situation?
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
as in subject.
What is the simplest way to check programatically if
Borland Database Engine is installed on local computer?
Thanks
|
|
|
|
|
Easiest to try and initialize it:
if(DbiInit(NULL) == DBIERR_NONE)<br />
{<br />
ShowMessage("BDE is installed");<br />
}
Bikram Singh
|
|
|
|
|
Hi,
I wonder if there is a way to execute a program from memory.
I've read exe-data from resources and I must execute it without writing to disk.
How could it be done?
NodeX
|
|
|
|
|
Not an area I know much about but trying doing a Google search for: Exe Packers or something like that. These are programs that compress Exe's and then decompress them when they are run.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
Not a way that I know of. Why are not able to write to disk first?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I'm thinking about simple protection against debugging
NodeX
|
|
|
|
|
What does debugging an application have to do with anything? And why do you want to be protected from it? If an application has errors, I would think you'd want to know about them.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
i have encoded exe-data (flash projector) in resources and i don't want others to get stuff (images etc.) from it...
ok.. it will only protect from simple resource-hackers etc. not from debugging (sorry for imprecision )
NodeX
|
|
|
|
|
Can you not write it to some temporary folder using an obscure name (i.e., nothing obvious), and then delete it when done? Other than that, I know of no way to run something from memory. It's a stretch, but you might search for something about "injecting code into another process' address space."
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
As a last resort i will do it with temp folder...
but i can't assume that the person who will have my cd-rom with exe, grant me an access to temp folder...
NodeX
|
|
|
|
|
NodeX wrote:
but i can't assume that the person who will have my cd-rom with exe, grant me an access to temp folder...
Why not use SHGetFolderPath() with CSIDL_LOCAL_APPDATA or CSIDL_PROFILE as the CSIDL?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
lol forget it, if someone wants to debug it, he will be able to!
Don't try it, just do it!
|
|
|
|
|
In Windows, the EXE file is mapped as virtual memory. The os loader and other parts of the os perform this task. The idea of running a program from memory, even if it could be done, would be meaningless.
Not worth spending time over. Remember, using this technique, you could bypass some anti-virus programs, but the good ones out there will catch it anyway...
Bikram Singh
|
|
|
|
|
Greetings All,
I've been burning up all of my time over the past two days trying to debug this. Please help!
I've written a DLL that creates a modeless dialog (in this case allowing the user to watch an aiming video image of a Laser Tracker.) This DLL is used by various client applications including my test app.
I need the user to be able to use the arrow keys to "jog" the Tracker from the dialog. Also, all of the normal dialog keyboard control needs to work (tabbing, typing into CEdit boxes, etc.)
At first, I couldn't even get key messages in the dialog...as soon as a key was pressed (with focus on the dialog), the message came to the client app. I found a way to fix this from MS' website involving having the app call a FilterDLLMsg() func from its PreTranslateMessage(). However, now when a key is pressed in the dialog, the dialog and app freeze.
I spent a long time tracing this freeze and it seemed to be freezing around the MFC code for _AfxFindNextMnem. I was stumped and thought it had to do with a tabstop or group setting for my dialog controls. Then I tried changing the m_pMainWnd = &dlg; line in my client application's InitInstance() to m_pMainWnd = NULL; . (It's a dialog based app.)
That corrected the freeze problem, but now any AfxMessageBoxes() I call from my client app seem to belong to the desktop instead of the main app dialog. There may be other, more serious, ramifications, but I haven't tested any further.
So, I don't want to change the m_pMainWnd = &dlg; if I don't have to, but for now, it's the only way I've found to keep the DLL/app from freezing. Is that safe? I'd prefer a different solution.
Has anyone out there ever seen this type of behavior? Any ideas? My brain is getting all mushy as I haven't made much progress on this
Thanks,
Justin
|
|
|
|