|
Hi,
I asked for a solution to open Access2000 mdb file from VC6 since VC 6 was not able to open the latest version of Access db. Peter Zajac gave me the solution, to include this line of code:
AfxGetModuleState()->m_dwVersion = 0x0601;
It works. But to find more info, I tried MSDN. But, to my surprise, there isnt any documentation available for this API.
In addition, MSDN mentions AFX_MODULE_STATE but there is no detail about this structure either. How can I find the information about these?
Also m_dwVersion is the version of what?
Ammar
|
|
|
|
|
Continuing on with my insignificant do nothing dialog application that implements many controls just for the sake of seeing how they work.
I have added a Progress Control that starts filling when the Start button is clicked, at the same time the button label changes to Stop. As you may have guessed I want the Progress Control to go up and down until such times as the Stop button is clicked. Can't figure out how to do this, initial thought is to use a thread to run the Progress Control and stop the thread when the Stop button is clicked. After reading Using User-Interface Threads by Joseph M Newcomer I am none the wiser, if the answer is in any of my Win32 and MFC programing books I can't find it.
Anyone have an answer for me.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
G'day Michael,
You could create a timer for the dialog window when the 'Start' button is clicked, then add a WM_TIMER handler to update the progress control on WM_TIMER events, and then kill the timer then the 'Stop' button is clicked.
Check out the CWnd::SetTimer() and CWnd::KillTimer() functions in the docs.
HTH,
Steve
|
|
|
|
|
Hi,
In Visual C++, if you create a file using CFile, is there any way to tell whether this file is a file or a folder? In Java, you can use "isDirectory()" to do this. Is there a
similar way in Visual C++? Thanks. Or is there any other way to create a file? Any suggestion or comment is appreciated.
Also, when using CFileDialog, all the folders and files will be displayed for you to select. Is there any way to only allow folders to show up? Thanks.
|
|
|
|
|
Try CFileFind::IsDirectory
By the way, Doesn't CFile always create a file?
I have never tried creating a folder. Can CFile do that?
Ammar
|
|
|
|
|
Sorry if I asked not good question. I am relatively new to Visual C++.
I tried the CfileFind class. It seems that this the right one. But I still have some problems. The following is the code I tried. It works ok to find the specific file or directory. But when I tried to test whether this is a directory or not, it gives an "assertion failure". I have no idea how it happenes. Can you tell me what went wrong? Also, if possible, can you give me a little example (several lines) of how this may work? Thanks a lot.
CFileFind finder;
BOOL bWorking = finder.FindFile(filename);
if(bWorking) {
if(finder.IsDirectory()) {
...............
|
|
|
|
|
Also, when using CFileDialog, all the folders and files will be displayed for you to select. Is there any way to only allow folders to show up?
CFileDialog is not meant to do this. The folder-selection dialog is done with the SHBrowseForFolder() API.
--Mike--
http://home.inreach.com/mdunn/
All your base are belong to ME~!
|
|
|
|
|
Hi,
First let me thank codeproject.com for these excellent forums.
I have an MFC-based control which uses PreCreateWindow to specify the class for the new controls window. Job is accomplished in 2 lines of code. I'm hoping that it is that easy in ATL. I've been learning as I go and perhaps (hopefully) it is easy. Any pointers or code samples would be appreciated.
|
|
|
|
|
In your CWindowImpl-derived class, use the DECLARE_WND_CLASS macro to set the window class name. Eg:
class CMyControl : public CWindowImpl<CMyControl>
{
...
DECLARE_WND_CLASS("MyATLControl")
};
--Mike--
http://home.inreach.com/mdunn/
All your base are belong to ME~!
|
|
|
|
|
I don't think this is correct. DECLARE_WND_CLASS gives the name of the new class. I want something more like DECLARE_WND_SUPERCLASS(), which seems to provide a mechanism for having both my class and the base class get messages. But I haven't found a real (meaning complete) example of using this. My ATL Wizard generated code has nothing like "class CMyControl : public CWindowImpl<cmycontrol> " in it.
|
|
|
|
|
I think I'm following this thread correctly. Have you tried using my CWindowImpl ATL Object Wizard? By setting a few items on the custom property page for the wizard you can get the desired effect I think you are looking for.
http://www.codeproject.com/atl/RBCWindowImpl.asp
Cheers,
-Erik
|
|
|
|
|
Hi Erik,
I saw your wizard while perusing codeproject.com . It looks applicable but I haven't had an opportunity to try it out yet. Thanks.
|
|
|
|
|
Hello. I have a derived CEdit control on my app which captures the Enter key. I can't figure out how to prevent that beeping noise whenever I press Enter. It's not in a dialog box btw. If anyone can give me any suggestions I'd appreciate it, thanks
Anthony
|
|
|
|
|
Before you translate the message check to see if the virtual key code is for VK_RETURN and if it is do what you need to and then set the key code for the message to 0 (Zero) before passing it to TranslateMessage and DispatchMessage.
-Erik
|
|
|
|
|
Sorry, forgot to mention I was using MFC
|
|
|
|
|
MFC Graphics classes like CBrush, CBitmap, etc. define a member "operator HBRUSH() const", or "operator HBITMAP() const".
I thought that you couldn't define new operator types! Somebody explain what these are
Bilal
|
|
|
|
|
MFC GDI classes like CBrush, CDC and CBitmap are merely thin wrappers around Win32 functions. Everything that CDC, for example, does is really a wrapper around functions of the same name. So CDC::CreateCompatibleDC is a wrapper around a function called CreateCompatibleDC, which takes the same variables as CreateCompatibleDC ( a pointer to a DC or NULL), plus a HDC, which is a handle to a DC. A major benefit of this is that they are cleaned up by the destructor - not calling delete on a GDI resource in a Win32 program is a sure fire way to achieve memory leaks and disaster, MFC makes it a little harder to mess up.
CDC as a class is then just a spot to hold a HDC and do HDC stuff to it. Any class can overload an operator in order to enable implicit casting to that type, for example a string class would overload char* so you could put an instance of the class where a char * is expected. The GDI classes have such an overload, so that anything that expects the handle can get it, although I usually point to the member variable ( such as m_hDC, m_hBitmap, etc. ) to be sure.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
A class can define conversion functions, which is what those MFC functions are. For example, CBrush::operator HBRUSH() is called if you pass a CBrush to a function expecting an HBRUSH , or if you explicitly cast a CBrush to HBRUSH .
You still use the keyword operator in the code.
--Mike--
http://home.inreach.com/mdunn/
All your base are belong to ME~!
|
|
|
|
|
I need to pass data between from a 32-bit to 16-bit process. I was thinking of using memory-map file. But someone told me that under 32-bit the memory-map file is private and the 16-bit process cannot read the location. Is this true? Is there other way to pass data beside using memory-map file?
|
|
|
|
|
Two methods come to mind, there may be more.
1) Use DDE (Dynamic data exchange). The DDEML library make this easier than using
the DDE functions directory. There are examples with MSVC 1.5 onwards and/or platform
SDK. MSVC 1.5 was 16 bit.
2) Use WM_COPYDATA and SendMessage().
This is defined for Win32 onwards, however there is nothing to prevent you using this
message (you may need to define it yourself for Win16) in your 16 bit programs.
I've done both of the above techniques in the past ('96/'97 ish) on both 16 and 32 bit
OSes.
Stephen Kellett
|
|
|
|
|
I am trying to use SetClassLongPtr() function but i get compilation error. MSDN says its available in winuser.h header but when I looked in my include directory for VC++, I couldn't find this function in winuser.h. I do have SetClassLong() in winuser.h file. I also installed SP5.
Any thoughts? Thank you,
Arpit Bhatt.
|
|
|
|
|
SetClassLongPtr() is the Win64-aware version of SetClassLong(). The former takes a LONG_PTR (long int, pointer-sized) whereas the latter takes a LONG (long int, always 32 bits). If you don't expect to be compiling or running on Win64 anytime soon, you can just use SetClassLong(). If you need to definition of SetClassLongPtr(), download the Platform SDK to get the latest header files.
--Mike--
http://home.inreach.com/mdunn/
All your base are belong to ME~!
|
|
|
|
|
Thanks for all the previous help, My App is in its final stage.
I have a reporting module in my app that generates a CTreeCtrl View of all the Work the User has done during their session, and is Serializeable as well.
When the User CLick on a Node of the tree I have a function that will output detailed information on the Action. INformation stored in Objects in an Obrray. My Problem is a simple One.
Where Can I put My output!!?
I can get the text and write the text but what I would like is an ajoined CEdit or Similar CWnd Derived object to output the text to.
How can I do this? WHat is the Best Method? I require it to be MultiLine as My output will look like this
Date: blaha alblka
Computer Name: ksdfjlkasjd
Action: COPY FILE
STEP 1: OPEN FILE :: SUCCESS!!
STEP 2: OPEN DEST :: SUCCESS!!
STEP 3: OPEN FILE :: SUCCESS!!
and so on.
Now Is there a way to use Set Window Text or similar function that will output a MultiLine String or a series of strings..
any help / suggestions would be appreciated.
thanks.
recurse.org - Recusion For the Rest Of Us.
|
|
|
|
|
A CEdit will show multiple lines if you output \n\r to denote a line end. In fact, you can do this in a static as well, even when you're using the dialog editor. Just type \n\r in your string and you'll get multiple lines. I guess you can therefore use CEdit or CStatic, it's up to you according to the appearance you want, plus the fact that a CEdit takes input ;0)
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
for that kind of output i use a listbox or listctrl
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|