|
MSDN says:
Windows NT 4.0 and earlier, Windows 95/98/Me: There is no way to get the thread handle from the thread identifier. If the handles were made available this way, the owning process could fail because another process unexpectedly performed an operation on one of its threads, such as suspending it, resuming it, adjusting its priority, or terminating it. Instead, you must request the handle from the thread creator or the thread itself.
A thread can use the GetCurrentThread function to retrieve a pseudo handle to its own thread object. This pseudo handle is valid only for the calling process; it cannot be inherited or duplicated for use by other processes. To get the real handle to the thread, given a pseudo handle, use the DuplicateHandle function.
|
|
|
|
|
I would like to implement a resizable dialog box with controls in the dialog box resizing along with the dialog borders. I tried adding guides and margins in the Microsoft Dialog Editor, but these margins do not seem to resize along with the dialog borders. Can anyone let me know how I can resize items along dialog borders?
Thanks in advance.
|
|
|
|
|
|
Hey,
First off if this is a really silly question then please excuse me but this is my first attempt at writing an application in c++.
I am trying to write a c++ program that can access a SQL Server database through ODBC/ADO(I don't care how just want it to work). I get c2059 error : 'constant'on the following line:
hr = m_pConnection->Open(_bstr_t(L"driver={sql server};SERVER=(local);Database=loggy;"),_bstr_t(L"sa"),_bstr_t(L"choices"),adModeUnknown);
Every command run after this complains about not being a member of _connection. I am using #import to import the msado15.dll whcih seems to be the best way(after many surfing hours). I would apreciate it if any one could help me. I think I have just put some code in the wrong place or something.
Thank you in advance
Regards
Adam
-------
Like you will ever visit my sites...
www.ufowatch.com - Seen a UFO then report it here or view over 500 different reports.
www.clubpages.co.uk - Taking the Bournemouth club scene through the millenium
|
|
|
|
|
I have lost the Admin password to a VSS database. Without this I can no longer run the SS Admin tool. Does anyone have an idea of how to recover for this situation?
Thanks.
Chris Meech
|
|
|
|
|
After a couple of hours searching through Google, I hit this great link.
http://groups.google.com/groups?q=VSS+ADMIN+PASSWORD&selm=93v9ll%24ldt%241%40nnrp1.deja.com&rnum=6
It gives a procedure for removing the password requirement for Admin. You use a hex editor to replace some values in the database's um.dat file and presto, you can now start the Admin utility without being prompted for a password.
Hope this helps out someone else.
Chris Meech
|
|
|
|
|
In a Document/View supported application,
Can i do this.........
CMyDoc::OnFileOpen()
{
...
...
..code
}
CMyView::OnFileOpen()
{
...
...
..another code
}
CMainFrame::OnFileOpen()
{
..
...
...
codes
}
will these code generate on error
|
|
|
|
|
Hi,
i think you will get an error something like function already exits....
regards ( new in vc++ )
Sonu
|
|
|
|
|
Maverick wrote:
will these code generate on error
No you will not get an error
But all three won't get called
Nish [anony posting from a net cafe]
|
|
|
|
|
Nish [I am not logged in] wrote:
No you will not get an error
Please Explain to me why you will not get an error.
Best regards
Sonu
|
|
|
|
|
This is simple. The function "OnFileOpen" is local to three different classes, namely CMyView, CMyFrame and CMyDoc. You would get an error if they were declared as global.
// Fazlul
Get RadVC today! Play RAD in VC++
http://www.capitolsoft.com
|
|
|
|
|
ahh.....
Got it thanx for the information....
regards
Sonu
|
|
|
|
|
If you have command handlers in view, frame and documents, then the framework will call the one in view only. If there is no handler in your view class, then the framework will try to dispatch the command in your frame class.
This might be more clear if you look in the MFC source code (in "winfrm.h", MFC7), where the message is actually dispatched.
BOOL CFrameWnd::OnCmdMsg(UINT nID, int nCode, void* pExtra,
AFX_CMDHANDLERINFO* pHandlerInfo)
{
CPushRoutingFrame push(this);
CView* pView = GetActiveView();
if (pView != NULL && pView->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
if (CWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
CWinApp* pApp = AfxGetApp();
if (pApp != NULL && pApp->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
return FALSE;
}
Hope this helps.
Regards.
// Fazlul
Get RadVC today! Play RAD in VC++
http://www.capitolsoft.com
|
|
|
|
|
Hello again everyone, and Happy New Year.
I'm relatively new to VC++ so I'll try to explain this the best I can. Here's my situation... I have an SDI app where the MainFrm is CSplitterWnd'ed into several different views. I have one view that is a "keypad" (CView) with a bitmap that resembles a standard keyboard numpad. If the user presses any numpad buttons, I want that view to "see" and process those window messages. The following snippet is how I'm trying to do it, but it doesn't seem to receive any messages. What am I missing??
// ==================================================================
void CMainFrame::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
ASSERT( GetActiveDocument() );
CClocksterDoc* pDoc = static_cast<cclocksterdoc*>(GetActiveDocument());
int iQty = 0;
switch(nChar)
{
case VK_NUMPAD1: iQty = OES_KEY_01; break;
case VK_NUMPAD2: iQty = OES_KEY_02; break;
case VK_NUMPAD3: iQty = OES_KEY_03; break;
......
}
if( iQty > 0 )
{
pDoc->DoPurchaseRequest( iQty );
}
CFrameWnd::OnKeyDown(nChar, nRepCnt, nFlags);
}
// ==================================================================
I hope explained this well enough.
Thanks...
Make no little plans; they have no magic to stir your blood to action. Make big plans, aim high in work and hope
-- Daniel Burnham
|
|
|
|
|
It's the view that receives key-down messages and not your CFrameWnd derived window
Nish
p.s. from cafe. so anony post
|
|
|
|
|
Thanks Nish. That works, but only when it has the focus. Is there a way to force the view to always receive the key-down message??
Thanks.
Make no little plans; they have no magic to stir your blood to action. Make big plans, aim high in work and hope
-- Daniel Burnham
|
|
|
|
|
You maybe interested in system wide event hooks.
Lookup SetWindowsHookEx
|
|
|
|
|
Just telling you that you have to do all hooks in a DLL if you want to catch when a key is pressed while your app is in no focus!
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
Richard Jacko & Rickard Andersson & All,
First, thanks for the reply. I think I'm headed in the right direction.
Secondly, I'm very new to Windows programming so I'd like to apologize for my "Windows ignorance" . Please bear with me...
From reading the docs on SetWindowsHookEx, I assume that I want to set the idHook = WH_KEYBOARD, right? Then, I have to write a DLL with a procedure that will handle the message (which I've never done).
Is this all correct? Thanks.
Marcus
Make no little plans; they have no magic to stir your blood to action. Make big plans, aim high in work and hope
-- Daniel Burnham
|
|
|
|
|
I have the following code that will attempt to print various files without the need of Print Previews etc.
temppath = patharray[0].Left(patharray[0].ReverseFind('\\')+1);
temppath += "ReportFiles\\My file.html";
ShellExecute(NULL, "print", temppath, NULL, NULL, NULL);
filestring.Format("Production sheet has been printed.", tempfile);
m_misc.InsertItem(12, filestring, 1); UpdateWindow();
However, when the print dialog appears I get the following error message appearing in a message box:-
"Cannot find the file 'D:\Test\ReportFiles\My file.html' (or one of its components). Make sure the path and filename are correct and that all required libraries are available."
Despit this message the file is found and prints OK!?!?! Is there any way to avoid this message from being shown.
Also, I would like to not have to show the print dialog box so that it will automatically print on completion of a task. Is there any way of doing this and also to print multiple copies of the report.
Any constructive suggestions would be greatly appreciated.
Cheers,
James
|
|
|
|
|
Ok I'm going to take a couple of guesses
1.)
ShellExecute uses the default file association in your case "html" to open the document.
So in effect you are probably using your browser to print for you. And probably you are using IE4+ to do your dirty printing.
Check to see it's just not your PC that has this problem,
(Us coders are quite likely to abuse file associations on development boxes)
So maybe your code will run OK on a neighbours PC but not yours.
2.)
Consider changing your NULL paramaters to empty variants, And turn off the "Active_Dektop"
3.)
Try using OLECMDEXECOPT_DONTPROMPTUSER
as a paramater, I think its the third one ?
4.)
Make sure your Browser can actually print without errors ocurring.
Regardz
Colin J Davies
Sonork ID 100.9197:ColinI live in Bob's HungOut now
A good example of "Fully Managed" coding
|
|
|
|
|
Hi Guys,
i want create a app which is able to connect to a database. This database is placed on the server. How should i connect to that database: ADO or ODBC or something else. Once i used ODBC to connect to a database but after i tryed to open 4-5 tables at the same time the computer becomes was very slow to show the data...I want to avoid this in future, HOW ??? Which database should i use ? The database must be able to guarentee access for more than one user.
Thanx
Sonu
|
|
|
|
|
That depends of you want...
You can find several classes for use ADO.
Do You have experience making querys?
When you work with databases, don't need open the tables all time...
You need to open, read the data, display only that you want, Update, or insert records.
Never Keep the tables open.
A question more?
What Database are using you?
Best Regards.
Today is Friday!!!! and Party!!!
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Yes, i have experience in making querys. If i am working with databases, i always use the technique which you said, just open at the required moment, read and display....I am closing the tables always in the destructor. Shall i close the table after finishing with that table ???
I was using MsAccess, but this database allows only access for one user at a time.
Which Database Technique should i use ADO or ODBC or something else and which Database shall i use ??? Maybe MySQL ???
regards
Sonu
|
|
|
|
|
You can use Access for 5 or 8 users, without problems. But you need to open the database in Shared mode for several users can to open de database....
I think that is beter that use ADO, because is more easy to use that ODBC, The performance is similar. You can find a couple of classes of ADO or ODBC in CP...
I love to work with Databases..
Best Regards...
Today is Friday!!! and Party!!!
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|