|
I have an MFC SDI application with split windows and tabs. See Dan Clark's design: "Drag & Drop & Background Image Tree Control". I have three panes based on CView that display internal information. Two panes are CFormView based to display lots of buttons, trees and lists. It's an instrument panel. The core code includes a compiler/interpreter for a proprietary language (like java) called HTL.
The problem: I also have two panes that are CRichEditView based. These are for the user to edit the HTL source code. The two views are already open in two panes. BUT, this is SDI, they don't have CDocuments, yet. How do I set up a doc/view architecture in InitInstance so that OnFileOpen() will add a doc and stick the file into one or the other view? Can I use CMultiDocTemplate in SDI? I don't want to create child windows like MDI does since I already have the window/pane set up. Right now it fails to find a view and then the frame calls OnInitialUpdate on everything and crashes when something gets called second time.
So Hum
|
|
|
|
|
I can not help you directly but you may take a look at this topic in the MSDN library, it may help you:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_core_document.2f.view_architecture_topics.asp
|
|
|
|
|
I have seen this in some games. I make different process for a single click with mouseup in a second and single click with mouseup after 1 second. how can i distingush both event? I'm using OnTimer to repeate this while clicking on a button.
I might not explain clear, but any one has solution?
Regards,
Shinya.
|
|
|
|
|
Get rid of the OnTimer.
In your buttondown handler, get the current time.
In your buttonup handler, also get the current time. Then compare the time to the time you got in the button down handler. Check if the difference is greater than or less than 1 second.
You can use CTime and CTimeSpan, or COleDateTime and COleDateTimeSpan, or SYSTEMTIME, or FILETIME, etc.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Now that I am actually on the right board, I hope...
I am trying to impliment a window in C++ that I can use in VB. Why? Because VB doesn't provide access to the two things I need for my project:
1. The ability to change the windows control container ambient property from runtime to design mode. I want to build a simple form designer into the program I am making. Most existing form designers cost money I don't have and can't be integrated into your own applications (even assuming I wanted the bloat from them).
A normal designer would be useless anyway. I need to have a way to describe how the events tie into other things. Basically the situation is like this:
[Client] [Forms Control]
|---Inbuilt functions <-- Inbuilt functions -| ^
|---Plugins (scripts) <----------------------/ |
\-----------------------------------------/
In other words, a button may pass the contents of a textbox on to the client's Send function when clicked. Something else may cause a Change event that needs to execute the CallPlugin function instead, which allows the script to ask for the data. There is no practical way to do this if I can't let the user specify which of these things to do in the form layout file. Traditional form designers just place the basic information on the control into the file, not extended stuff like I need.
However, as usual the Unholy Order of MSDN doesn't provide any usable information on control containers and every web page seems to involve how to get the ambient properties, but not change them. Ironically the one page that I once found, when looking for how to change the multiline property of a textbox in VB (go figure..), I can no longer find, or remember what odd combo of search terms I used to accidentally get there.
Help finding usable information on actually using control containers and setting their ambient properties would be greatly appreciated.
2. Eventually I would like to be able to let the users add 'any' control they like through the designer. The problem is that I have no way of knowing what controls I plan to use before hand, so I can't build in a comprehensive list of every event that I need to trap. I *think* I may have some idea how to trap and handle events other than the known ones like 'Click', which all controls tend to have, but I have no idea how to properly get a list of possible events or how to use that information to identify unknown events and deal with them. As usually, all documentation on the subject refers to using known events and its sole concession to the possibility that such unknown events even exist is something like:
ElseIf
'Put code to handle unexpected events here..
C++ code refering to this isn't any better, but I figure that if I have a list of things the object *should* do, then there may be some chance of figuring out which event it did fire. Nice that this tiny key detail escaped the notice of all those experts writing example code. Kind of like how MFC docs always assume you know which header file to look in for the value of the WTF_ISTHIS flag for some API call (or that you even have the needed files). lol
|
|
|
|
|
Ok.. I have mananaged to actually find an online copy of the files for CPatron, which claimed to show how to use control containers, but as usually only provided 'half' the information about them.... The half that was missing was of course involved with setting properties, instead of just reading them. Sigh....
Anyway, I hunted a *lot* more and found:
dispparams.rgvarg[0].vt = VT_BOOL;
dispparams.rgvarg[0].bool = FALSE; // Or TRUE for *run mode*.
dispparams.rgdispidNamedArgs = DISPID_PROPERTYPUT;
dispparams.cArgs = 1;
dispparams.cNamedArgs = 1;
hreselt = Object->Invoke(DISPID_AMBIENT_USERMODE, NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYPUT, dispparams, NULL, NULL, NULL);
Which I assume will do what I want... Anyone have a clue if a VC++ class that impliments this can call the Invoke property of a VB window, or am I going to have to build my own window in VC++ to handle that as well?
Still hunting for info on how to find out what events a control fires, I just hope it is slightly less frustrating to find...
|
|
|
|
|
We have a suite of apps (GUI, console, server, on Win and Unix) that constitute a release. Our xplatform build script gets the current version number (eg: "4.1.0") from an env var, and creates a text file (eg: CurrVersion.h) in its pre-build step, that has a few #define s a la:
#define CurrentVersionMajor 4
#define CurrentVersionMinor 1
#define CurrentVersionPatch 0
The Unix apps just use these #define s and bake the version info into themselves. CurrVersion.h is not stored in CVS - it's generated at build time and deleted when the build cleans up. This scheme does away with having every developer remember to change their app's version info before releasing.
I'm trying to do the same thing for Windows and have run into a problem.
Generating a Windows version resource in a pre-build step is easy, but having it referenced by a Windows app's .rc file at compile time isn't. It seems that that the version info needs to be *in* the app's .rc file (and can't be just referenced from another location, or be present in an rc2 ). Also, #includ ing another file from the app's .rc file isn't foolproof, since MSDEV regens the .rc when you add/modify/delete resources, overwriting your #include statement.
Any ideas?
Notes:
- I don't want my prebuild step to directly hack the
.rc file (by inserting the generated version resource), because the .rc is under version control and should only be edited by a developer.
- I could muck with the resource info in the .exe in a post- build step, but I prefer to have a human-readable source code solution.
- I've already read the version-related articles at CP.
Thanks,
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
The way I did this once was three-step. First I modified the version resource in the .rc file to:
#include "somefile.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION MY_FILE_VERSION
PRODUCTVERSION MY_PROD_VERSION
... Then in the somefile.h file, I'd have:
#define MY_FILE_VERSION 1,2,3,4
#define MY_PROD_VERSION 1,2,0,3 Part of the build process was to run a little utility I wrote that parsed the somefile.h file and incremented the numbers accordingly.
Probably not the most elegant solution, but it worked for our situation.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Doesn't your #include statement get overwritten when the .rc is edited in the resource editor?
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
No, it stayed intact.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hmm, DevStudio wipes out my #include when I edit the .rc (eg: by adding/modifying a dialog).
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Let me look through my archives and I'll send you what I used.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
|
Thanx just what i was looking for.
Still Alive!!!
Thank you God.
|
|
|
|
|
Unfortunately, it doesn't work.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
|
Unfortunately, a version resource appears to be only recognized when present in the .rc file, not in the .rc2 (or #includ ed by it).
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi,
I have a question about creating sockets which can connect and dis-connect. I tried using set socket options with the REUSEADDR option. It does not seem to work. I get an error when I disconnect and try to re-connect. First, I set the socket and then I call set socket options before I perform a bind. Is this the correct procedure? Any ideas on what I'm doing wrong?
|
|
|
|
|
Anonymous wrote:
error when I disconnect and try to re-connect.
is the client trying to bind? clints dont bind, servers bind.
Still Alive!!!
Thank you God.
|
|
|
|
|
I have an executable. If the user clicks on it, and
types in some data and saves and retrieves, there is no
problem.
If they click on the executable twice and two instances
popup, then data between the two programs is getting
mixed. I designed the software to save and retrieve
temporary data from ascii txt files stored in this
one directory. So both instances are accessing that
same temporary directory and the data is getting mixed
up.
I either have to rewrite my saving and retrieving
mechanism...or is there a way to only let one instance
of an executable be executed at a time?
Please any response any one can give me will be greatly
appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
See here and here.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Create a Mutex call GetLastError, if it returns ERROR_ALREADY_EXISTS, there is another instance runnning. If not release the mutex just before your app is unloading.
|
|
|
|
|
About a month ago I found a dandy little article that demonstrated how to retrieve a Bitmap image from the clipboard.
The author created a single structure containing a BITMAPHEADERINFO and another structure (BITMAP?). This was mapped to the global memory data he got from the clipboard. He then was able to get an HBITMAP and HPALETTE and display the image.
The secret the author discovered was that Microsoft did not document that these are the two datastructures microsoft uses to put a bitmap on the clipboard.
I've searched everywhere. I'm sure I saw it here on the Code Project but I cannot find it now.
I've found some other articles on reading bitmaps from the clipboard. I want this one because it was so simple.
Thanks,
Sieg
Sieg_Heintze@yahoo.com
|
|
|
|
|
Was it this one?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Thank you to those who have helped me before. It has been a tremendous help. Because of you guys I was able to figure my errors and get done what I wanted to get done.
My new problem should be easy I just don't really know how to use what I got. I'm trying to format a edit box to display the currency symbol($) and set the precision that way my user(s) can't put in more then 2 after the decimal. (i.e. 12.333). I was reading this article and I was beganing to understand it but when I tried it out it didn't work. If anyone has any insight plz let me know.
http://www.codeproject.com/editctrl/ncpedit.asp#xx37605xx
Sincerely
David Berg
AIM- CaNorDBerG
email- quake3b@yahoo.com
|
|
|
|