|
MSDN has information here[^] on support for cryptography. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Have a look at the CryptEncode/CryptDecrypt functions.
|
|
|
|
|
I am just asking for an opinion / verification of my code approach.
All my references (#include and DLL) are functioning as expected.
I am using MFC extension DLL and operator new in main application constructor:
COpenHRApp::COpenHRApp()
{
TRACE("COpenHRApp::COpenHRApp()\n");
pLog = new OpenHR_Log ; // initialize Log DLL
pSerial = new OpenHR_Serial; // serial communication test
pRegistry = new OpenHR_Registry; // registry access
TRACE("COpenHRApp::COpenHRApp()\n");
}
Here is the initial debug trace:
Loaded 'D:\WINNT\system32\ntdll.dll', no matching symbolic information found.
Loaded symbols for 'R:\0\HR\DLL\V1\OpenHR\Debug\OpenHR__DLL_Log.dll'
Loaded symbols for 'D:\WINNT\system32\MFC42D.DLL'
Loaded symbols for 'D:\WINNT\system32\MSVCRTD.DLL'
Loaded 'D:\WINNT\system32\KERNEL32.DLL', no matching symbolic information found.
Loaded 'D:\WINNT\system32\GDI32.DLL', no matching symbolic information found.
Loaded 'D:\WINNT\system32\USER32.DLL', no matching symbolic information found.
Loaded symbols for 'R:\0\HR\DLL\V1\OpenHR\Debug\OpenHR__DLL_Serial.dll'
Loaded symbols for 'R:\0\HR\DLL\V1\OpenHR\Debug\OpenHR__DLL_Registry.dll'
Loaded symbols for 'R:\0\HR\DLL\V1\OpenHR\Debug\OpenHR__DLL_Main_Ext.dll'
Loaded symbols for 'D:\WINNT\system32\MFCO42D.DLL'
OPENHR__DLL_LOG.DLL Initializing!
OPENHR__DLL_SERIAL.DLL Initializing!
OPENHR__DLL_REGISTRY.DLL Initializing!
OPENHR__DLL_MAIN_EXT.DLL Initializing!
COpenHRApp::COpenHRApp()
CopenHRApp::COpenHRApp()
One question– I did not add any DDL .lib references to my project setting and so far everything is working as expected.
Any comments on that?
As always I appreciate your help and time.
Thanks
Vaclav
|
|
|
|
|
Vaclav_Sal wrote: I did not add any DDL .lib references to my project setting...
There are three (known for me) ways to the success :
- lib is included in the project tree of your application
- lib is referenced by #pragma comment(lib, "...")
- lib is set in the projects settings
P.S. try to call a non-inline method of a new result virtual void BeHappy() = 0;
modified on Thursday, March 11, 2010 11:03 AM
|
|
|
|
|
Hi all,
How to close the child process when parent process crashes?
thanks,
|
|
|
|
|
You can add a crash handler in the parent process and in that function you can notify the child process to exit.
to install a crash handler check the API's
AddVectoredExceptionHandler
or
SetUnhandledExceptionFilter
|
|
|
|
|
It could be performed in the CATCH_ALL section of the parent process virtual void BeHappy() = 0;
|
|
|
|
|
|
Here's a demonstration of the technique I described last time you asked this question.
#include "stdafx.h"
#include <windows.h>
#include <conio.h>
#include <memory.h>
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
HANDLE GetMyHandle()
{
HANDLE hPseudo = GetCurrentProcess();
HANDLE hMe;
DuplicateHandle(
hPseudo,
hPseudo,
hPseudo,
&hMe,
SYNCHRONIZE,
TRUE,
0
);
return hMe;
}
int main(int argc, char* argv[])
{
cout << "Parent process..." << endl;
HANDLE hMe = GetMyHandle();
char me[MAX_PATH];
GetModuleFileName(NULL, me, sizeof(me));
string child = me;
child = child.substr(0, child.find_last_of('\\'));
child += "\\Child.exe";
ostringstream oss;
oss << "\"" << child << "\" " << reinterpret_cast<void*>(hMe);
string cmd = oss.str();
char *pCmd = new char[cmd.length()+1];
memcpy(pCmd, cmd.c_str(), cmd.length()+1);
PROCESS_INFORMATION pi;
STARTUPINFO si = {0};
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_NORMAL;
CreateProcess(
NULL,
pCmd,
NULL,
NULL,
TRUE,
CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_CONSOLE,
NULL,
NULL,
&si,
&pi
);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
CloseHandle(hMe);
delete [] pCmd;
cout << "Press any key to crash parent..." << endl;
_getch();
*(char*)0 = 0;
return 0;
}
#include "stdafx.h"
#include <windows.h>
#include <iostream>
#include <sstream>
using namespace std;
int main(int argc, char* argv[])
{
void* val;
istringstream iss(argv[1]);
iss >> val;
HANDLE hParent = reinterpret_cast<HANDLE>(val);
cout << "Child got HANDLE " << val << ". Waiting..." << endl;
WaitForSingleObject(hParent, INFINITE);
CloseHandle(hParent);
return 0;
} Steve
|
|
|
|
|
Hi all,
Please help me in below scinario.
I have one win32 exe made for Windows mobile in VC++,which is running in background.I want to write some code which should execute at 12:01 Am daily.
I have used timer but it is not running in standby(Sleep) Mode of device. I have also found something CeRunAppAtTime but on some link it is written that this won't work in sleep mode of device & also it is not supported by all devices.
Please let me know what i have to do? How can i resolve this problem.
Thanks in advance.
|
|
|
|
|
First of all, we don't offer help on an urgent basis here. Second, this is the C++ forum and you should not be posting a Windows Mobile query here.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
hi everybody !
I'm writing a program in c++ using visual studio 2005.
I have 2 project in 1 solution. the first project's job is to show a simple form.
the second project's job is to show a form with a button. if the buuton is pressed the program should search for the first form, then close it if it finds it and if it dosen't -show a massage.
I'm trying NOT to use FindWindow(), but use LoadLibrary() in order to find the first program..
I'm having difficulties in understanding what I have to do (the button's code, functions to use etc.). I've searched a lot the msdn and visual studio help ,but didn't find anything clear and usefull...
can someone PLEASE help me ??
thank's a lot !!
|
|
|
|
|
You can use named events using CreateEvent or custom messages using RegisterWindowMessage to achieve this task.
|
|
|
|
|
|
tamar82 wrote: I'm trying NOT to use FindWindow(), but use LoadLibrary() in order to find the first program..
Why?If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I second superman's suggestion. Just use RegisterWindowMeesage() to register a Unique message. If the first window doesn't exist (use FindWindow() or you could enumerate through the processes to see if the process exists), show an error.
If the first window exists, then post a WM_CLOSE from second window to the first one.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
I have added 2 CMFCSpinButtonCtrl to my ribbon menu now I want know how could I handle a message in my view class to see which spin control and which button of that control (up/down) is pressed I know it is something related to UDN_DELTAPOS But I don't know How To implement it
|
|
|
|
|
Does the following work ? :
BEGIN_MESSAGE_MAP(CDrawView, CView)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN1, OnUpDown)
END_MESSAGE_MAP()
void CDrawView::OnUpDown(NMHDR *pNMHDR, LRESULT *result)
{
NM_UPDOWN* pUpDown = (NM_UPDOWN*) pNMHDR;
bool bUp = 0 < pUpDown->iDelta;
...
} virtual void BeHappy() = 0;
|
|
|
|
|
Thanks Your code structure seems correct but unfortunately the UDN_DELTAPOS message didn't work I also tested WM_VSCROLL with ON_NOTIFY but it didn't work too.
|
|
|
|
|
0. Try to analyze the sent messages to the view window by clicking using Spy++
1. Elsewise - Derivate your own control from CMFCSpinButtonCtrl (like CMFCRibbonSpinButtonCtrl )
to implement your own reaction for:
afx_msg void CYourCtrl::OnLButtonUp(UINT nFlags, CPoint point)
{
if (CMFCSpinButtonCtrl::m_bIsButtonPressedUp) {
} else
if (CMFCSpinButtonCtrl::m_bIsButtonPressedDown) {
}
CMFCSpinButtonCtrl::OnLButtonUp(nFlags, point);
} virtual void BeHappy() = 0;
modified on Thursday, March 11, 2010 5:12 AM
|
|
|
|
|
Im writing MPEG4 into AVI container.
Im using compression as mmioFOURCC('x', 'v', 'i', 'd');
When i play AVI file,it shows no decoder module found.
How to solve this?
|
|
|
|
|
Just install Windows Media 9 series Codec and try...
|
|
|
|
|
or any other MPEG4 decoders like K-Lite which can decode the frames u write..
|
|
|
|
|
Actually,when i open that .avi with notepad it looks like this:
RIFFbí AVI LISTÀ hdrlavih8 è è
`
ð LISTt strlstrh8 vidsDX50
zûˆ
`
ð strf( 0ƒØÌÌÌÌÌÌÌÌvidsDX50 JUNK
Some junk value has been written.Thatsy VLC shows
-- logger module started --
main error: no suitable decoder module for fourcc `ÌÌÌÌ'.
VLC probably does not support this sound or video format.
-- logger module stopped --
How to solve this?
|
|
|
|
|
I think the Codec which i used is not correct.
bcz when i play that AVI in VLC,the log message shows as follows
-- logger module started --
main error: no suitable decoder module for fourcc `ÌÌÌÌ'.
VLC probably does not support this sound or video format.
|
|
|
|