|
Wot about providing a web based interface on the server so that clients can communicate with the hardware after they are authenticated.
Providing an interface (with no direct connection to hardware) on the server will always help you in long term. ie, if after some time if you want you can even change the entire hardware and its APIs without your clients even knowing it. Only thing you will have to do is to change the interface on the server accordingly.
greatest thing is to do wot others think you cant suhredayan@omniquad.com
|
|
|
|
|
Thanks for the reply.
As i mentioned the client side siftware is ready now. i.e if i install the software in any machine making the hardware public, i can talk to the hardware.Now i have to make the same software work when i have 2 networks. Is there any way i can write some code at server so that the same software can be used at any client machine ? I do not want to re write all the hardware API's for the server. In otherwords, how can i do the action of a API called on a client machine in the hardware through a server???
Shashi
|
|
|
|
|
Hello,
I am trying to use the waitable timer in a MFC project and using MsgWaitForMultipleObjectsEx() to wait
on the timer handle. But my timer callback doesnot get executed. Below is the source code with all
the error checking removed. Please help me to fix this problem.
OS Version: Windows 2000
VC Version: 6.0
//Globals
int wLoopCount= 0;
void CTimerTestDlg::OnStartTimer()
{
HANDLE hTimer[1];
LARGE_INTEGER liDueTime;
int breakLoop = 0;
int retVal = 0;
// Create waitable timer
hTimer[0] = CreateWaitableTimer(NULL, TRUE, "WaitableTimer");
// start the timer 5 sec from now and tick every 2 sec
liDueTime.QuadPart = -50000000;
SetWaitableTimer(hTimer[0], &liDueTime, 2000, TimerProc, NULL, 0);
wLoopCount = 0;
while (breakLoop == 0) {
retVal = MsgWaitForMultipleObjectsEx(1, hTimer, INFINITE, QS_ALLEVENTS, MWMO_ALERTABLE );
switch (retVal) {
case WAIT_OBJECT_0:
if (wLoopCount == 100) {
CancelWaitableTimer(hTimer[0]);
breakLoop = 1;
}
break;
}
}
CloseHandle (hTimer[0]);
return;
}
VOID CALLBACK TimerProc(LPVOID lpArg, DWORD dwTimerLowValue, DWORD dwTimerHighValue)
{
wLoopCount++;
}
|
|
|
|
|
In your code, why are you calling MsgWaitForMultipleObjectsEx() and not MsgWaitForMultipleObjects()?
One solution is a timer queue timer.
CreateTimerQueueTimer()
Kuphryn
|
|
|
|
|
Howdy,
I have an application that uses CDHtmlDialog. I'd like to display ActiveX objects on the dialog. The problem is that if the user doesn't permit ActiveX on Internet Explorer, then I can't use them on CDHtmlDialog either.
I've played with using GetOptionKeyPath, but the security options seem to be set in the registry in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings rather than in the key for IE.
Is there a way to display ActiveX objects in CDHtmlDialog without gettings warnings based on the IE options?
|
|
|
|
|
Is there any way to just change the alignment of header part only?
I want to make field name to be centered and rest of items to be right
justified. I try to use headerctrl to change the alignment, but
always change the alignment for a columns
CHeaderCtrl* pHeaderCtrl = m_GroupList.GetHeaderCtrl();
if (pHeaderCtrl)
{
HDITEM hdi;
char buffer[256]="ddd";
hdi.mask = HDI_TEXT|HDI_FORMAT;
hdi.pszText = buffer;
hdi.cchTextMax = 256;
hdi.fmt = HDF_CENTER | HDF_STRING;
pHeaderCtrl->SetItem(0, &hdi);
}
this will make the first column all centered.
I don't know why?
|
|
|
|
|
All,
I'm trying to do basic file I/O within the main dialog routine, the routine that all the GUI window notifications (WM_TIMER, etc.) are sent to. Is this allowed? The reason I ask is because when I try running the code I get a "Debug Assertion Failure" that states:
File: fprintf
Line: 56
Expression: Str != NULL
I'm pretty new to Visual C++ so it may be that I just can't do file I/O there...
Robert
|
|
|
|
|
When I go into the debugger the first argument to fprintf *str is apparently null. But, I don't open the file until a button on the GUI is pressed. The file name is based on the time that the button is hit. After opening the file I call SetTimer to fire every second at which time I try to write to the file. So, I wouldn't think that I would be writing to the file until the global variable FileOut2 gets set...
|
|
|
|
|
So what happens first, fopen() or fprintf() ?
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
I'm developing a VC++ SDI program that needs to have a couple threads running. The main thread starts by pressing a button in the toolbar which is processed in the Document. This thread reads from a data file once a second, this data is stored as variables in the Document, after this data is read and stored I need to update the View, however I have not been successful at having the View update with out crashing the program.
I have the program setup as a SDI and have added a CWinThread Class. I have been successfull at reading the data with the class but just not updating the View.
Any help with this problem would be great.
J Guds
Masters Student
Kansas University
|
|
|
|
|
The UI is "owned" by the primary thread and should only be updated by it. All other threads should post (not send) a message to the primary thread indicating an update needs to be done. Check out this article.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
I suggest you to take a luck at example from “msdn” documentation “MTMDI” that demonstrates an MFC User Interface Thread. For avoiding potential problems when programming multithreaded applications you need to respect some rolls or programming tips that is also described in “mfc” documentation.
Ex: - You can't have two threads manipulating the same object.., if you need this you need to protect such access with appropriate Win32 synchronization mechanisms...
- A thread can access only MFC objects that it created, a worker thread cannot perform a calculation and then call a document’s “UpdateAllViews” member function to have the windows that contain views on the new data modified, because the map from CWnd objects to HWNDs is local to the primary thread. There are several ways around this problem: you can pass individual handles (such as an HWND) rather than C++ objects to the worker thread, or you can create new user-defined messages corresponding to the different tasks your worker threads will be performing and post these messages to the application’s main window using PostMessage.
If this little help is not enough for your problem send me a sample of your code and I will help you.
CC.
|
|
|
|
|
I have a program that puts an icon in the tray. When someone locks the workstation the unlocks the station, the icon is gone though the process is still going. What causes this?
|
|
|
|
|
AUGH! I hate it when the description of the problem is vage.
It isn't when someone locks the screen, its when Windows locks up! You know, like when you are deleting a lot of big files in Explorer, it breaks, you tell the process to end, the entire screen goes blue, then the desktop appears.
Hope that makes more sense!
|
|
|
|
|
That happens because explorer restarts, you need to reinstall the icon. You can detect when this happens by handling "TaskbarCreated" message.
see:
http://www.microsoft.com/msj/0299/c/c0299.aspx
Edward.
|
|
|
|
|
Is it very difficult to take an existing relaively basic Visual C++ application and extend it to be accessible through a brwoser interface?
Can anyone point me to some FAQ or other resources?
Thank You!
|
|
|
|
|
Yes, and no. It all depends on your existing application. If you have a very modular backend, and preferably accessible through COM/dispatch interfaces, it's really easy to hack up an ASP interface. I guess there are other ways to add a web interface to your app. Managed C++ and ASP.NET comes to mind.
I think you should first asses the modularity of your application back end first. If it's not modular enough to support a totally different front end, you'll probably end up rewriting the whole thing anyway. Then it's better to realize that from the start and save some time.
--
Gott weiß ich will kein Engel sein.
|
|
|
|
|
|
That looks like a really cool piece of technology. And at the same time it makes me very sad knowing about this, while being stuck with J2EE.
--
Gott weiß ich will kein Engel sein.
|
|
|
|
|
I am writing a simple dialog-based application in Visual C++ & don't know how to get arguments for the program. E.g. if my program is executed as :
MyProgram.exe Param1 Param2
I would like to get Param1 and Param2
I know that in Console-based applications, there is a "main(argc, argv)" but couldn't find a similar method for my dialog-based applications.
I tried the GetCommandLine, but it seems like it only returns the path to the execution program (C:\Program Files\ ... \MyProgram.exe).
Thanks a lot for any help.
|
|
|
|
|
That should return the command line arguments as well...
There are global variables (declared in stdarg) that have the command line and should be available in any VC program:
__argc,__targv
John
|
|
|
|
|
hongheo76 wrote:
I know that in Console-based applications, there is a "main(argc, argv)" but couldn't find a similar method for my dialog-based applications.
They exist in Windows applications as well, just named __argc and __argv .
hongheo76 wrote:
I tried the GetCommandLine, but it seems like it only returns the path to the execution program (C:\Program Files\ ... \MyProgram.exe).
How are you using it? The docs indicate that it can be used in the manner in which you desire. I just tried it in one of my apps and it worked fine.
Is this an MFC application? If so, have you looked at CWinApp::m_lpCmdLine ?
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
There's a member variable m_lpCmdLine in the CWinApp class, and it's public. So AfxGetApp()->m_lpCmdLine where do the work.
|
|
|
|
|
You can use the argv/argc stuff or use the Win32 API function GetCommandLine().
onwards and upwards...
|
|
|
|
|
Thanks a lot
I used CWinApp::m_pCmdLine and it worked.
|
|
|
|