|
Is it safe to say that every user-mode process is a child of either the Services Controller (services.exe) or the Shell (explorer.exe) ??
Does the User32::ShellExecute function ultimately resolve to a call to CreateProcess, or does ShellExecute ultimately create the given process with calls to native functions??
|
|
|
|
|
I have an edit box on my property page that I want to check to make sure the user is putting the proper data in. In order to do this I use OnKillFocus() and set the focus back to edit box which has a problem. This works fine.
My problem is that when I switch to a different page on my property sheet, it does not keep the previous page up front. I still get the message box that I throw for errors, but the page still becomes inactive. I tried to use a ShowWindow(SW_SHOWNORMAL) but it looks like the new tab is still selected even though it show the contents of the previous tab.
Thanks in advance!
|
|
|
|
|
In the OnKillActive() method, what value are you returning?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
that method returns a void. All I really do is throw a MessageBox("Error") message in there.
|
|
|
|
|
NYTSX wrote: that method returns a void.
For a window/control, yes. OnKillActive() should return non-zero if losing focus is allowed, 0 otherwise.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
OK, maybe I am really unclear.
I am using the OnKillFocus() for an EditBox. My problem is that when I switch tabs, it throws the error but still allows for the tab to be changed. I ideally would like for the tab not to be switched at all.
Thanks for all your help.
|
|
|
|
|
NYTSX wrote: I ideally would like for the tab not to be switched at all.
Which is why I suggested overriding OnKillActive() .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I was trying to do use SetActiveWindow() and/or ShowWindow() in the OnKillActive() and neither do what I want. Should I be doing something else?
Thanks for being so patient!
|
|
|
|
|
NYTSX wrote: I was trying to do use SetActiveWindow() and/or ShowWindow() in the OnKillActive() and neither do what I want.
There's no need to do any of that. Simply return 0 from OnKillActive() if you do not want the tab to change. A value of 1, which is the default, will allow the tab to be changed.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
How to define and use 3 sockets which should be always open to 3 different locations and work as TCP/IP listening and sending messages which come in XML format like <start><id>id<id><name>name<name>.... Do I have to write three different socket class?
Thanks,
nahitan
|
|
|
|
|
I'm no Lord of Sockets, but I can tell you that if you want to have continuous connections to 3 different hosts, then you will need 3 separate sockets.
A TCP/IP socket does not know anything about XML. It is up to your program to interpret the XML. The only thing the socket does is send and receive packets of bytes.
|
|
|
|
|
Hello!
I make simple dialog based programs. I make them with resource editor VS.NET 2003. When I create dialog it is grey. After I put some other controls on it. What is the easiest way to make Dialog based application with some background of some predefined background (picture)? Instead of grey there would be some picture.
Best regards,
Rostfrei
|
|
|
|
|
Hi Rostfrei ,
if you need to paint dialog use WM_CTLCOLOR
and if you want to draw picture I suggestion that use picture's in the WM_PAINT and the use handle dc
|
|
|
|
|
include ->atlImage.h //in h file
CImage m_Image;//in h file
m_Image.Load("c:\\picture.bmp");//[in the OnInitDialog(example)]
in function Onpaint
CPaintDC dc(this); // device context for painting
m_Image.BitBlt(dc.m_hDC,CRect(0,0,800,600),CPoint(0,0));
|
|
|
|
|
When I include atlImage.h
I get many errors like:
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _malloc already defined in msvcrtd.lib(MSVCR71D.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _free already defined in msvcrtd.lib(MSVCR71D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit already defined in msvcrtd.lib(MSVCR71D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __exit already defined in msvcrtd.lib(MSVCR71D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __cexit already defined in msvcrtd.lib(MSVCR71D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __c_exit already defined in msvcrtd.lib(MSVCR71D.dll)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in msvcrtd.lib(cinitexe.obj)
and so on...
What shoild I do?
Rostfrei
|
|
|
|
|
It works!!! I can't thank you enough!!!
To resolve linkage problem I had to
Ignore specific library: libcmtd.lib
The problem is described on http://discuss.microsoft.com/SCRIPTS/WA-MSD.EXE?A2=ind9710a&L=atl&P=5867[^]
in project settings. Now it works just as I wanted.
Ah yes, for anyone else reading this you have to include #include <afxstr.h> before #include <atlimage.h> like:
<br />
#include "afxstr.h"<br />
#include "atlimage.h"<br />
Thank you!
Regards,
Rostfrei
|
|
|
|
|
I have a NCRPOSAPI.dll file from NCR printer. Now I generate a Com wrapper. . I'm using Visual C++ to generate a COM. There is an export function
UINT NCRPOS_PrinterStatus(LPTR Printername) from this DLL.
But calling this function I have a linking problem. Do I need to generate an LIB file? and How? Please help!.
AV
|
|
|
|
|
Maybe you can post exact nature of linking problem.
There can be several possible issues, but without knowing which linking problem you have, we can not give proper answer.
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
My application is creating a COM wrapper (using Visual C++ version 6.0)that call a function from a NCRPOSAPI.dll
The CMonitor cMon object is exposed and could be initialized from another VB.NET project and following with a call cMon.Start("NCR 7167 Receipt").
In Start function of CMonitor object, a CreateThread function is called which perform another thread; here it is TimerThreadProc(). The TimerThreadProc function calls TimerThread function of CMonitor object. A TimerThread calls a GetNCRMonStatus function. This function never return properly.
GetNCRMonStatus function is a function that calling an exported function from NCRPOSAPI.dll.
If I call the "GetNCRMonStatus" function directly from the Start function ( not put it in the function of CreateThread), it will work fine.
Something conflict in multiple threads and calling a function from a DLL which is loaded at run time.
I have no linking problem, the app. is not working. I want to keep communicating to printer and get the printer status back. But after the first polling, the thread is lost and exited. Please help !!!!
I want to attach the zip file of my C++ project, but don't know how... Below is the functions and methods related... Hope you could help.
STDMETHODIMP CMonitor::Start(BSTR printerName)
{
Stop();
_bstr_t usbPrinterName = printerName;
if (!OpenPrinter(usbPrinterName, &hPrinter, NULL))
return E_INVALIDARG;
events[EVT_NOTIFY] = FindFirstPrinterChangeNotification(hPrinter, PRINTER_CHANGE_ADD_JOB | PRINTER_CHANGE_DELETE_JOB, 0, NULL);
if (!events[EVT_NOTIFY])
{
ClosePrinter(hPrinter);
hPrinter = NULL;
return E_INVALIDARG;
}
ResetEvent(events[EVT_STOP]);
LoadNCRLibrary();
/* If I call getMCRMonStatus() here, the function return fine
GetNCRMonStatus();
return S_OK; */
DWORD timerThreadId = 0;
timerThread = CreateThread(NULL, 0, TimerThreadProc, this, 0, &timerThreadId);
return S_OK;
}
STDMETHODIMP CMonitor::Stop()
{
if (timerThread != NULL)
{
ReleaseLibrary();
SetEvent(events[EVT_STOP]);
WaitForSingleObject(timerThread, INFINITE);
CloseHandle(timerThread);
timerThread = NULL;
}
FindClosePrinterChangeNotification(events[EVT_NOTIFY]);
events[EVT_NOTIFY] = NULL;
ClosePrinter(hPrinter);
hPrinter = NULL;
FreeLibrary(hLibrary);
hLibrary=NULL;
hFunction=NULL;
return S_OK;
}
bool CMonitor::LoadNCRLibrary()
{
char Path[256];
char SystemDir[256];
if(hLibrary == NULL)
{
GetSystemDirectory((LPTSTR)SystemDir,MAX_PATH);
strcpy(Path,SystemDir);
strcat(Path,"\\");
strcat(Path,"NCRPOSAPI.DLL");
hLibrary =LoadLibrary(Path) ;
}
_ASSERTE(hLibrary);
hFunction = (UVOID) GetProcAddres(hLibrary,"NCRPOS_PrinterStatus");
return (hFunction!=NULL);
}
DWORD WINAPI TimerThreadProc(LPVOID ptr)
{
CoInitialize(NULL);
CMonitor* pMon = dynamic_cast<cmonitor*>((CMonitor*)ptr);
_ASSERTE(pMon != NULL);
pMon->TimerThread();
CoUninitialize();
return 0;
}
void CMonitor::TimerThread()
{
DWORD waitHandle = WAIT_TIMEOUT; // Triggers initial status check befor
do {
GetNCRMonStatus();
}while ((waitHandle = WaitForMultipleObjects(NUM_EVTS, events, FALSE, timerInterval)) != WAIT_OBJECT_0 + EVT_STOP);
}
int CMonitor::GetNCRMonStatus()
{
DWORD NCRPOSMsg=5;
if (hFunction("NCR 7167 Receipt",(LPDWORD)&NCRPOSMsg)==0)
{
int i= 0; //ErrorPrinter /Driver
}
Sleep(5000);
return NCRPOSMsg;
}
BH
|
|
|
|
|
You can not load a DLL and have a new thread start in the same sequence. Windows prevents this.
Your thread will only begin to run after the 'loading' of the DLL has completed.
It would be better not to have ANYTHING done within the 'path' of the DLL_OROCESS_ATTACH orCOM modules Init routines. A separate 'start' should be issued once your application has stabilized, or AFTER all the calls to LoadLibrary have completed.
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
Hello @all =)
I am actually working on a project which should make installation, configuration and custmoization of Windows XP a better experience than working with unattended stuff.
What I need is a 3in1 application.
<br />
#1 - Installation assistant<br />
#2 - Configuration assistant<br />
#3 - Customization assistant<br />
The name X-10 stands for 10 ways of customization.
A short guide what X-10 shall do.
- Give integrated driver support for nearly all hardware available _/ <-done
- use of a Windows Preinstallation Environment for building the installation
configuration (through XML)
- Windows installation Assistant - 3 step Setup _/ <-needs work (40% done)
- 10 Presetpacks selectable through the Assistant /
(Shellpack,Registrypack,Applicationpack,Fontpack, CustomSystem32pack
Optionalpack and Userdefined mode) _/ <-needs work (60% done)
- Customizing Systemfiles (usb,tcp,wga,audio..)
- A new compression solution to make your installation faster and smaller.
(Recompression of all setup files into a single archive which is handled by
the Preinstalltion Environment.
This makes original setup step 1 unneccessary and speeds up the rest.)
- A special updatepack for Windows XP SP2 which integrates the latest updates and more (serebys work).
- And last but not least, shrinking of the CD size. (thanks to nuhi's nLite)
[b]Do you want to join my X-10 Project?[/b]
I hope u will or u know other creative people who are familiar with programming.
The more people we are the faster and better we will be.
This is project is so complex that it is splitted into 3 projects which are modular and can be used single.
1st-Project: PE-X10
Customized Windows PE (or barts PE..) to prepare the setup.
2nd: X-10
PresetPacks (creating Shell-, Registry-, Application- ,Font- and CustomSystem32packs) for the assitant.
3rd: THIS IS FINISHED (by another guy)
Universal Driverpacks to enable nearly all devices on Windows XP without the need of bloated drivers.
I hope I get much feedback, ideas or recommendations.
NOW YOU CAN RECOMMONDATE WISHES OR WANTED FEATURES!!;)
when this projects finishes its 1st phase, I will make a projectwebsite for it.
To code the Installaller you need to know Visual C++, I visualize a MediaCenter like menu.
I will make this project opensource in sf.net when it finishes.
This means when all functions, replacements and hacks are initiated by the assitant and not by replacing files .
|
|
|
|
|
Xsss4hell wrote: I am actually working on a project which should make installation, configuration and custmoization of Windows XP
don't you think it's time to give Vista a try ?
|
|
|
|
|
nice thought but did you know vista is bloated piece of sh*t for some of us?
The only fine thing on it is its installer.. and the enhanced security and administration.. nobody needs ms nobody needs copyright..
but DO NOT let us discuss about Vista..
It WIL come and conquer the market..
|
|
|
|
|
are you serious ?
|
|
|
|
|
while using free() to free up calloc'ed arrays, I get the following error:
-------------------------
Debug Assertion Failed!
Program C:\...\sim.exe
File: dbgheap.c
Line:1017
Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts.
(Press retry to debug this application)
------------ another error message i get ------
Program C:\...\sim.exe
Debug Error!
DAMAGE: after Normal block (#50) at 0x00440040
(Press retry to debug this application)
-------------------------
the exact code used is:
list=calloc(e,sizeof(int));
slist=calloc(e,sizeof(int));
nodes = (int *)malloc(nelems*sizeof(int));
.
.
.
free((void *) list );
free((void *) slist);
free(nodes);
----------------------
Does anyone know anything about this? Care to advise?
Thanks in advance...
|
|
|
|