|
|
|
hello,
how can i get the total no of pages printed in one print job in vc++ /win32 appln.
please give some code ...
|
|
|
|
|
Search for Q196805 in MSDN there is a Article about print monitors and some sample code
if you want to Download the sample code
Click ME[^]
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
The GetJob API call will give you number of pages and copies - although for truely rteliable page counts you will need to dissect the spool file.
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
hello ,
how to get the full path of the printed file in vc++ ?/?
please give the explaination with code example
panda
|
|
|
|
|
Search for Q196805 in MSDN there is a Article about print monitors and some sample code
if you want to Download the sample code
Click ME[^]
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
hello all,
how to gerister a dll in vc++ editor ,in command prompt and in run dialog ?
panda
|
|
|
|
|
use RegSvr32 file.dll
if you have the Code then open it in VC and goto Tools and Register Control
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
thanks monty sir,,,,
skpanda
|
|
|
|
|
MailMonty wrote:
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
R u in liging process or learning process?
I was born intelligent Education ruined me!.
|
|
|
|
|
I'm trying to create a SDI MFC application with two CViews for a game(level editor).
One main view where you can see the level map and a secondary view to the right where you can select tiles to place in the level map.
I was wondering what's the best way of creating these two views.
The view that's created by the framework takes up the whole window, is there any way to have it be a certain size?
I don't want to use splitter windows(unless you can have a splitter that can't be moved, I want fixed sizes for the windows).
|
|
|
|
|
Use the Splitter Window
and to stop the Resizing of the Splitter window
Derive a class from CSplitterWnd
and Override HitTest and return 0 from it
<
class CExSplitterWnd : public CSplitterWnd
{
.....
virtual int HitTest(CPoint pt) const;
....
};
int CExSplitterWnd::HitTest(CPoint pt) const
{
return 0;
}
>
this will freeze the frames
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
Tryed it, doesn't work. Does anyone know how to prevent a splitter from resizing?
|
|
|
|
|
It works like a Charm everytime i do it you must be doing something wrong
check the MSDN Online for article no 105150
or
click me[^]
if you want ur application's resizing stopped try to handle mainframe's onsize or mouse click events(NC)
if you don't want to use Splitter window at all then create a CView and in the CView create two child windows side by side (handle all the sizing in OnSize event)
u'll get the desiered results
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
I overrode the onsize event, that seemed to do the trick, thanks.
|
|
|
|
|
Why not have the selectable tiles as a toolbar? (unless you have thousands of different tiles...)
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
Hello to anyone who is willing to put a little thought in this.
I am in a quite hopless position right now.
The problem is this:
Suppose that there is a program that is running under Windows 95, 98 or ME, and this program malfunctions and freezes at some point. An external process (another program), learns this (
via means of a common bit in the LPT1, or a memory location being written periodically with '1' or '0' , so that the 'external watchdog program' gets the changes and knows if the program is still alive or not).
This, under Microsoft C++, would naturally involve CreateProcess or ShellExecute API calls to spawn the process and TerminateProcess to kill it. The problem is that under testing, when I terminate and re-spawn the process at regular 20s. intervals, after a while (it may be a few minutes up to half an hour, i.e. from 10 - 200 re-spawns), I get the Pop-Up Window
"Windows cannot find xxx.xxx. Please make sure the file exists e.t.c."
The weird thing is that CreateProcess API returns succesfully
and the GetLastError function is equal to 0, i.e. no error!
This happens when I run my code under Windows 95, 98 or ME.
Under Windows XP and for 12 hours consecutivelly the program runs fine. What could be the issue here?
**Note that both processes are console applications.**
I also tried putting a significantly long wait between the kill and the re-spawning (e.g. 13 seconds) but to no avail.
Something gets corrupted at some point but I have not been able to trace what. I do not think memory leaks is an issue in this case as the program is fairly simplistic and I close all handles normally.
I post some sample code below:
#include "stdafx.h"
#include "GetProcessID.h"
#include <tlhelp32.h>
#include <conio.h>
#define Debug true
unsigned char bit;
void killTheOther();
void RebootTheOther();
PROCESS_INFORMATION ProcessInfo;
STARTUPINFO StartupInfo = {0};
HANDLE theHandle;
int main(int argc, char* argv[])
{
UINT nactual = 0;
unsigned char temp = '0';
int SetWaiting = 0;
SetConsoleTitle("Stupid");
HANDLE Done = CreateEvent(0, FALSE, FALSE, 0);
// ensure window title has been updated
// look for newWindowTitle
Sleep(40);
HWND hwndFound = FindWindow(NULL, "Stupid");
// If found, hide it
if ( hwndFound != NULL){
//ShowWindow( hwndFound, SW_HIDE);
}
CloseHandle(hwndFound);
StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow = SW_SHOW;
if (!(CreateProcess("C:\\2.exe", NULL, NULL, NULL, FALSE,
CREATE_SUSPENDED | CREATE_NEW_CONSOLE, NULL, NULL,
&StartupInfo, &ProcessInfo))){
printf("Could not start process..., beacause:%d \n",
GetLastError());
theHandle =NULL;
}
else {
ResumeThread(ProcessInfo.hThread);
if (Debug)
printf("Process is started...\n");
theHandle = ProcessInfo.hProcess;
}
while(true){
bit = '0';
temp = bit;
if (Debug)
printf("Checking status...\n");
if (temp == bit){
SetWaiting++;
}
else{
SetWaiting = 0;
}
if (SetWaiting > 2){
printf("Here...\n");
if(theHandle != NULL){
killTheOther();
Sleep(10000);
RebootTheOther();
}
else{
printf("The han is NULL\n");
}
SetWaiting = 0;
}
WaitForSingleObject(Done, 10000);
}
return 0;
}
void killTheOther(){
TerminateProcess(theHandle, 0);
CloseHandle(theHandle);
theHandle = NULL;
}
void RebootTheOther(){
CloseHandle(ProcessInfo.hProcess);
CloseHandle(ProcessInfo.hThread);
if (!(CreateProcess("C:\\2.exe", NULL, NULL, NULL,
FALSE, CREATE_SUSPENDED |
CREATE_NEW_CONSOLE, NULL, NULL, &StartupInfo,
&ProcessInfo))){
if (Debug)
printf("Could not start process...\n");
theHandle = NULL;
}
else {
ResumeThread(ProcessInfo.hThread);
if (Debug)
printf("Process is started...\n");
theHandle = ProcessInfo.hProcess;
}
}
Sorry about my English
|
|
|
|
|
When TerminateProcess Terminates a Process it Doesn't terminates them Nicely , it Kills the Process then and there
so ur application doesn't get a chance to free resources (handles or other stuff) .
you would imagine that under such situation something is bound to be a miss if you are killing and spawning 200 times
you could try to create the new process without a console
that might do the trick (i.e without CREATE_NEW_CONSOLE )
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
No I am afraid it doesn't work without the
CREATE_NEW_CONSOLE MACRO either. I have tried pretty much everything. Even different
API's like ShellExecute e.t.c.
I agree with you it must be something to
do with TerminateProcess, but there is no
other way, is there? I mean ExitProcess
just terminates the process/thread where
it is called from. Is it possible to terminate a child process via means other than the TerminateProcess?
|
|
|
|
|
If you have to Terminate a Process Cause it is Hanged up , then there is no other way but to Terminate the Process except for calling TerminateProcess
but i can't see that happening 200 times
i think you need to rethink ur app design
if you want to terminate an application then you can use Events (SetEvent) to signal a termination request.
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
Well if the program frezees there is no way it will respond to a terminate signal.
Thanks anyway though!
|
|
|
|
|
hi all,
i m generating a log file for network printer in win 2000 .
when i did not set any user name & password ,the log file was generated successfully.
but when i set the username (administrator) with blank password and then when i m running the application , it was unable to create log file for printer.
is it registry problem.
shall i go to registry ???? to check ?
if so what is the registry path to set the user name & password as my program reads the username from registry.
please help.
skpanda
|
|
|
|
|
|
I get the following error, after i complie from release mode to debug mode, I aslo go for full rebuild, but still i
get the below stuff,
CAN any one explain me what this error is and how to resolve this error!!!
Linking...
LINK : LNK6004: Debug/MMCt.exe not found or not built by the last incremental link; performing full link
LINK : error : Internal error during ReadSymbolTable
ExceptionCode = C0000005
ExceptionFlags = 00000000
ExceptionAddress = 004622E0
NumberParameters = 00000002
ExceptionInformation[ 0] = 00000000
ExceptionInformation[ 1] = 0059F218
CONTEXT:
Eax = FFFFFFFF Esp = 0012E6BC
Ebx = 00000002 Ebp = 0059DE98
Ecx = 032E0164 Esi = 00000271
Edx = 00000BB4 Edi = 403EF0CC
Eip = 004622E0 EFlags = 00010206
SegCs = 0000001B SegDs = 00000023
SegSs = 00000023 SegEs = 00000023
SegFs = 00000038 SegGs = 00000000
Dr0 = 0012E6BC Dr3 = 00000002
Dr1 = 0059DE98 Dr6 = 032E0164
Dr2 = 00000000 Dr7 = 00000000
Error executing link.exe.
Tool execution canceled by user.
/* and i never canceled the execution but still i get "Tool execution canceled by user." WHY?
|
|
|
|