|
G'day,
I'm thinking of porting one of our apps from DAO to ODBC for database access. I understand the correlation between CDaoDatabase/CDatabase and CDaoRecordset/CRecordset, but was wondering if there are any ODBC equivalents to the DAO CDaoTableDef and related classes?
When opening a database, my apps always check that the database's schema is complete and up to date. The apps create any new tables/fields that are required before proceeding.
I'd like to be able to do the same thing with the ODBC version, but the only obvious solution I see is sending raw SQL to the data source via the ODBC API. This is OK, but I was wondering if any of you ODBC gurus out there have a more elegant solution.
Actually, in an ideal world, I'd like my apps to support both DAO (speedy single-user performance) and ODBC (multi-user client/server), but I guess that's too much to hope for.
Any advice would be appreciated.
TIA
Steve
|
|
|
|
|
Hi,
Use ATL's OLE DB Provider, Consumer Templates. This will satisfy all yr requirements. Or use OLEDB
MFC class instead. These stuffs r esay to use and also gives fast and reliable services than that of other
MFC stuffs.
|
|
|
|
|
Thanks for that Mathan.
I was browsing the MSDN help & MS web sites last night and ended up printing off a zillion topics on DB access. I'm just puring my way through the pros and cons of the various options today. I'll check out the OLEDB stuff later.
Thanks again,
Steve
--------------------------------------
Steve Driessens
|
|
|
|
|
I am trying to create a webbased text editor using MFC ActiveX.
To do this, I created an MFC activeX file with all the default options.
Then, I created a new class using the Wizard, which subclasses RichEditCtrl.
I included the header file of this class to my main ActiveX file(i.e. xxxCtl.h
file ) , created a member variable for the RichEditCtrl class inside my xxxCtl.h
file and then, used its Create method, to create an instance of it within
my ActiveX's OnCreate method.
i.e.
in my header, I got
CRichEditor x;
in my ActiveX cpp, I got
CMainCtrl::OnCreate()
{
...
x.Create(.......);
}
That's all fine as I get one big honking Edit box.
But now, I want to add menus and stuff and can't figure out a way to do that.
Anyone out there would know about this? Typically, menus are part of the
CMainFrame, but since this is an AcitveX and has no frame, I am not sure
where I could create it!
I would really appreciate the feedback!
thanks
|
|
|
|
|
You create the menus in the handler for WM_CONTEXTMENU or WM_RBUTTONDOWN.
|
|
|
|
|
Hi there and thanks for the response!
I actually meant menus for toolbars...
I want to add a toolbar and then add menus to it, but I am not sure how, since that kind of thing is usually done at a FrameWnd level and MFC ActiveXs don't have any Frames as far as I know!
|
|
|
|
|
Help me somebody. Please.
When I start using function from the NetBIOS interface like UCHAR ret=Netbios(PNCB pncb);
my linker send me error LNK2001: unresolved external symbol _Netbios@4.
I connect "Nb30.h" file.
What the problem? The samples from MSDN also want not link.
If you can help, please help me solve this problem.
|
|
|
|
|
The header file means you can compile, but you need to include the .lib file in your Object/Library modules ( under 'Link' in project properties)
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Big Thanks.
It's very easy, after learn it.
|
|
|
|
|
Please see the zip file at:
www.freebox.com/g8rpal/cfinal.zip
I am having problems completing this assignment and any help would be greatly appreciated...
All files are in the zip.
Thanks!
|
|
|
|
|
Dear All !
We are trying to use the Stingray Object Edit MFC Control
(SECEditCtrl)as a child window and a CWindowImpl derived class as its parent.
All is working except the cursor keys and the enter, backspace and delete keys do nothing. But we can type in text and selecting with the mouse and setting the caret with the mouse is working.
Any ideas on how to use a MFC CWnd inside a ATL/WTL CWindowImpl class.
Kind regards,
Alex Klinsky
ATAIR Software, Austria
|
|
|
|
|
I'm working on a small utility that I want to be able to update itself via int internet (via FTP). The user will select a drop-down menu item "Check for update". At startup, if possible, a couple different files are already pulled down from the FTP server I'm using so pulling down an updated EXE should be easy enough. In fact, I already implemented all of that including the version checking... everything except how to actually replace/relaunch the EXE. What is the best way to go about doing this?
|
|
|
|
|
Here is a way that occurs to me:
Write a second application to do the update, let's call it "update.exe" and your utility program "utility.exe".
When your utility gets an update:
1)it saves the new version of itself using a temporary filename
2) it creates a named mutex
3) it starts update.exe which blocks on this mutex.
4) the utility terminates, releasing the named mutex right before it dies.
The running update application senses that the mutex has been released and then deletes the old "utility.exe" and renames the temporary file to "utility.exe".
If your utility needs to save state between incarnations then it can do so using an ini file or registry entries.
|
|
|
|
|
That sounds pretty good and wouldn't be very difficult at all to implement. However, the utility is pretty small and my goal is to keep it as simple as possible for distribution.
It's purpose is to keep a device of ours updated by querying for current version information, checking the FTP server for the latest updates, bringing them down, and putting the updates on the device. All this works fine. However, I ALSO want the utility to update itself if/when the need arrives.
Our customer base isn't exactly technically savy at times so the goal is to make this as simple as possible. Therefore, I'd like to work out some way to do this all in one EXE.
In UNIX I remember there was a way to rename the executable at runtime. Is there a way to do this with an MFC app? Then I could rename the running app, download the new version, shut down the renamed app and launch the new one. Is that possible?
|
|
|
|
|
>>>In UNIX I remember there was a way to rename the
>>>executable at runtime. Is there a way to do this with an
>>>>MFC app? Then I could rename the running app, download >>>the new version, shut down the renamed app and launch >>>the new one. Is that possible?
I don't believe you can, Please disprove me.
Ok here is another easy method
run OldApp,
When OldApp runs it checks a reg value to see if NewAPP exists,
if NewApp exists
{ OldApp executes NewApp
OldApp dies
} /// This leaves only NewApp running
else {OldApp Continues}
The only disadvantages with this are minimal,
You have two exe's instead of one installed !
Regardz
Colin Davies
|
|
|
|
|
I've done this before.
What I did was to download new.exe to a temporary folder named something like temp.exe then run it as such:
temp.exe -replace c:\path\to\current.exe
then immediatly exit current.exe
temp.exe should read the command line and set a timer for like 5 seconds (make sure we give current.exe enough time to exit) the timer will delete current.exe, copy its self over current.exe, and then run it as such:
c:\path\to\current.exe -delete c:\path\to\temp.exe
current.exe will then be your updated exe and should delete the temporary file.
Hope this helps
-zack
|
|
|
|
|
There's a bug in Windows ListCtrl, (Report mode), using GRIDLINES.
When scrolling from right to left slowly, vertical lines are not drawn.
This happens because (aparentrly) the control draws the vertical lines whem drawing the subitems which are on the right of the line. When scrolling from right to left, there will be a moment when left subitems appears completely visible on the screen, but the left line wont be visible. If we scroll again to the left, this line wont be drawn (BUG) because these subitem don't require to be redrawn.
I Fix this bug by invalidating the rectangle where the left line should be when scrolling.
Is there a FIX to the ComCtl32.dll?
|
|
|
|
|
What's the difference between using CWnd::SubclassDlgItem and use DDX_Control? I've noticed that ClassWizard uses DDX_Control.
|
|
|
|
|
I have created a Tree Control using ActiveX, and have done my own drawing by overriding the CTreeCtrl::OnPaint. However, when I try to draw icons using the CDC::DrawIcon function, my icons always appears at 32x32.
I have created an icon resource which is 16x16, loaded it into a HICON variable using ::LoadImage in an overridden CTreeCtrl::PreCreateWindow function, and in my overridden CTreeCtrl::OnPaint called the function
memDC.DrawIcon( point, m_hIcon )
where memDC is a CDC object, point is a CPoint and m_hIcon is my HICON variable.
What appears is the correct icon, but it has been stretched horizontally and vertically by a factor of 2. How do I prevent this so my output icon is 16x16 ????
Thanks
Ant
|
|
|
|
|
Use DrawIconEx() instead - it has parameters where you specify the height/width of the icon.
--Mike--
http://home.inreach.com/mdunn/
"Didn't I tell you? I've got a brain the size of a planet."
--Marvin the paranoid android
|
|
|
|
|
I have a little problem in one of my programs. I want to use the scroll bars of a CView. How can I get pointers to them? I've tried CView::GetScrollBarCtrl(SB_VERT/HORZ), but it returns a NULL pointer.
I have added the line 'cs.style |= ( WS_HSCROLL | CS_VSCROLL );' in PreCreateWindow
Thanks very much in advance.
Erik
|
|
|
|
|
How can I create buttons with labels on a toolbar, like the Search, Favorites and History buttons on the Internet Explorer 5 toolbar?
|
|
|
|
|
|
I want to play a wav included in a resource dll file with a thousand of wav (98 Mb) in it. I use 'LoadResourceEx' but it doesnt works, can you help me.
Here's my code segment:
HINSTANCE m_hResource;
m_hResource = LoadLibraryEx("MyDll",NULL,LOAD_LIBRARY_AS_DATAFILE);
AfxSetResourceHandle(m_hResource);
HINSTANCE hInst = AfxGetResourceHandle( );
LPCSTR sound;
HANDLE hResource;
LPCTSTR nom("NameoftheWav");
hResource = LoadResource( hInst, FindResourceEx( hInst, "WAV", nom ,MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL))); /*WAV is the type defined in the .rc file */
sound = ( LPCSTR )LockResource( hResource );
sndPlaySound( sound, SND_NODEFAULT );
UnlockResource( hResource );
FreeResource( hResource );
FreeLibrary(m_hResource);
Thanks in advance.
Eric Tremblay
Multimedia Programmer,
QA-International
Quebec, Canada
|
|
|
|
|
I need to determine users rights to access files in NT, but I don't have their passwords to open their tokens.
Functions like AccessCheck() require the user token, which is obtained by LogonUser(), but it requires the user password.
I found a partial solution which is opening the file ACE list, and compare user and ACE SIDs, but if the ACE SID identifies a group, I've found no way to check it against the user SID.
Does anyone know how to do this?
|
|
|
|