|
I used this and it works. Most probably the first 3 lines are missing from your code (the 'defines" )...
#define _WINVER 0x0500
#define _WIN32_WINNT 0x0500
#include <Windows.h>
#ifdef _DEBUG
#include <ConIO.h>
#endif
#include <StdIO.h>
VOID Error_DisplayLastW(
IN LPCWSTR pwszMsg
);
int
main(
IN int argc,
IN char **argv
)
{
__try
{
puts("Preparing to lock workstation...\n");
if(!LockWorkStation())
{
Error_DisplayLastW(L"LockWorkStation");
__leave;
}
puts("Workstation unlocked.\n");
}
__finally
{
puts("Finally.\n");
}
puts("Exiting.\n");
return
#ifdef _DEBUG
!_getch()
#else
0
#endif
;
argc;
argv;
}
VOID
Error_DisplayLastW(
IN LPCWSTR pwszMsg
)
{
LPWSTR pwszMessage;
if(FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
GetLastError(), 0, (LPWSTR)&pwszMessage, 0, NULL))
{
fprintf(stdout, "%S %S\n", pwszMsg ? pwszMsg : L"", pwszMessage);
LocalFree(pwszMessage);
}
}
|
|
|
|
|
I always forgot the include >...< forms...
The include section is
#include >Windows.h<
#ifdef _DEBUG
#include >ConIO.h<
#endif
#include >StdIO.h<
|
|
|
|
|
#include <Windows.h>
#ifdef _DEBUG
#include <ConIO.h>
#endif
#include <StdIO.h>
|
|
|
|
|
hello,everyone!
I have made a ActiveX Control about report using MFC on VC6.0,and I want to make the print and
print preview methods in the control.Using it I can print report very easy.But I have some trouble while I do it!
Please give me a hand!
Thanks advanced!
|
|
|
|
|
Hi,
We can't help you, when we haven't any information about your ActiveX or your source code ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Thank you for the answer from you!
I am sorry I don't tell about the Print ActiveX.
This ActiveX is made by VC6.0 and MFC,and about a grid ctrl.
So I want to create the methods of Print and Printpreview in the ActiveX and I can call the method in other app to print the report.
but when I create the printpreview method I have a trouble :That I must
have CFrameWnd point,but I don't how to get the CFramewnd point in the
ActiveX.
That is all,Please give me a hand!
Thanks.
|
|
|
|
|
Have no idea how to add new caption button (like close(x), minimize(_) etc.) to title bar, like it is in GetRight (Docking button (.)). Answer if you know...
|
|
|
|
|
Paul DiLascia wrote about this back in '97, here is the link to the article.
http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0697/c++0697.htm
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
I have a problem I just don't get.
I have created two programs, a ProgramApp and a ProgramDLL. The ProgramApp is a SDI and I create a standard modeless dialog when it starts up. Next I load the ProgramDLL so the ProgramApp can use it. I call a function in the Program DLL called ChangeDialogText( lpDlg ), this function sends the lpDlg pointer to the ProgramDLL when calling the ChangeDialogText( lpDlg ).
ok, so far so good,.. now the ProgramDLL has a singal line that does this lpDlg->SetWindowText( "DLL Text" ).... bang here I get an assert that the lpDlg doesn't have a m_hWnd??!?!?!
I have the AFX_MANAGE_STATE(AfxGetStaticModuleState()) in the beginning of the ChangeDialogText function.
I just don't understand it,... it should work. what am I doing wrong.
|
|
|
|
|
I had the same problem through a COM ATL DLL, but the solution is the same, just build a release version of your DLL, it should work (ASSERT only in debug).
Celhtar
|
|
|
|
|
What you can't see won't hurt you
|
|
|
|
|
err, now you are confusing me even more
Peter Marino ( www.marino.dk )
|
|
|
|
|
That isn't a very good solution. I do need my debug version... for debugging and if it asserts then I'm doing something I shouldn't. The assert comes from the ::IsWindow( m_hWnd ) , the m_hWnd comes from my ProgramApp and I can use the lpDlg->SetWindowText( "Whatever" ) without anyproblems,.. but sending the lpDlg over to the DLL and using the same lpDlg->SetWindowText( "Whatever" ) asserts in the ::IsWindow function. The m_hWnd and lpDlg are the same both in the ProgramApp and ProgramDLL.
For some reason the ProgramDLL can't see that the m_hWnd is a valid window in the ProgramDLL?! and this confuses me,.. I have now used 3 days and nights trying to solve this problem.
Peter Marino ( www.marino.dk )
|
|
|
|
|
Try building both the exe and the dll using MFC in a shared DLL. I found this problem too, and using shared dll's it was solved...
Somehow when you use MFC in a shared DLL both the EXE and the DLL will use the same heap or something and pointers can do their work better...
You can find the option in the project settings of the project (left tab).
Please, let me know if it helped you.
Structured programming vs. chaotic mind boggling
|
|
|
|
|
Hi ,
I'm developing the component which calls the stored procs
in oracle. My component is being called in the threads
released by a TCPIP server. I want to know.
1) Is it ok to accept the ADO connection object ( same obj
every time) from the caller, if yes how can i pass it thru
interface?
2) Or should I accept the connection string everytime and
try to connect to oracle.
Can anyone suggest better and safe scenario to get my
work done
Thanking in advance.
Regards
Popsy
.
|
|
|
|
|
I'm going to build a server application, which will be divided into 4 different services. Those services might run on different servers...
I have done a lot of thinking about the communication between those services. They will all run on the same machine, or different machines on a LAN, so the communication protocol don't need to be routable...
I was thinking about going for Named Pipes, be cause I know how to work with those. But Named Pipes doesn't scale well. I mean I meight have 4 threads in service 1, that all might want some data from service 2.
Any thoughts? COM+, DCOM, Sockets, whatever?
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
How about DDE? It may be old, but it might fit your needs. You can send any type of data with it, and the applications don’t have to be on the same computer. Plus its relatively easy to learn and use.
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
Im trying to push buttons within a form on a web site. Is there any events or commands that anyone knows of that will allow me to do this? for example ebay has a form with a "Submit Bid" button.. I would like to be able to push the "Submit Bid" Button with my app..
Any help would be appreciated!
Thanks,
Rob
|
|
|
|
|
I know I can use GetDocument->UpdateAllViews(0) to clear the screen in VIEW.CPP ..... but how can i clear the screen if my function is located in another non-MFC file??????? I just use something liked
::InvalidateRect(Handler, NULL, FALSE);
to update the view.....
Can you help me????
What i want to do is keep printing a list of number.....for example,
1
2
3
4
5
6
7
and the program has to compare the previous number....if the previous number is 7...then I have to erase the 7 and put an A there......but I have to display "7" first...then when it's going to display another .....let say 8....then the list should be
1
2
3
4
5
6
A
8
|
|
|
|
|
Hi!
Is there a way to emulate the WinNT VirtualAllocEx() function on WinCE.
In other words, I am trying to reserve and commit a region of memory within
the virtual address space of a specified process in WinCE, but am not able to
do so because WinCE only supports VirtualAlloc().
I am also trying to create a thread that runs in the virtual address space
of another process in WinCE, and since the CreateRemoteThread function is not
defined I am unable to do so.
I would greatly appreciate if a solution to either of the above could be found.!
|
|
|
|
|
Hi!
I want to create a console application that looks like the Lotus Server, i.e. like a normal console but all the input goes on the last row with other things (logs in that case) being updated while I can write commands. Does anyone know how to create an app like this, an example would be great!
|
|
|
|
|
In my MDI app I made a class that derives from CDocument and another that derives from CView. I also added the CMultiDocTemplate in the InitInstance method of the App class.
My problem is in trying to add the GetDocument() function to my new view. This line in the view's header file:
CVideoDoc* GetDocument() {return (CVideoDoc*)CView::GetDocument();}
gives me these compilation errors in the header file:
error C2143: syntax error : missing ';' before '*'
error C2501: 'CVideoDoc' : missing storage-class or type specifiers
error C2501: 'GetDocument' : missing storage-class or type specifiers
I've compared this to working code, and I don't know the problem. It's gotta be something simple that I just didn't think of. Any help is appreciated.
thanks,
Jake
|
|
|
|
|
Include your document class header file in the appropriate file.
you can simply put #include "videodoc.h" in your view class.
HTH
Jignesh
|
|
|
|
|
I had been including VideoDoc.h in the view's .cpp file. I changed that to include it in the view's .h file, and it's good to go. Thanks,
Jake
|
|
|
|
|
I want to use the status bar in my Dialog based app!
but this code doesn't show the status bar!
m_SB.Create(this);
m_SB.Indicator(indicator, sizeof(in..)); // I think the funck was Inicator or spmething!
but there is no control when my app is running!
I wrote it in OnInitDialog
|
|
|
|