|
have you tried adding one .DEF for each configuration then excluding each from the build that doesn't use it (right-click, properties, choose the appropriate config, exclude from build) ?
i've never tried that with .def files, but it works for source files.
|
|
|
|
|
Thanks for your response,
Yes I tried this. Basically Microsoft Visual Studio stops you from adding more than one .def file to any project.
So regardless if its a single configuration project or if it is a multi configuration project you can only have one .def file.
I am trying to add the .def file using the IDE's add to project methodology so you may know around this that I don't.
|
|
|
|
|
is there any reason you need to specify the DLL's name in the .DEF file ? it's not required for the linker.
the .DEFs we use typically only have a DESCRIPTION tag and then the EXPORTS list
|
|
|
|
|
Oh wow hey cool! Your right, the LIBRARY line will force a dependancy on a paticular name. But if you don't have the LIBRARY line in the .def file then the dependancy on the name is the name of the .dll itself.
Thanks! Much happiness
|
|
|
|
|
Hi all,
I am trying to create DSN SQL Server at run time,but i am not able to do it.
bool aDSNCreated = false;
RETCODE retcode= SQL_SUCCESS;
aDSNCreated = SQLConfigDataSource(NULL, ODBC_ADD_DSN, "SQL Server (*.MDF) \0", _T("DSN=Login\DBQ=E:\\Login_Data.MDF\0")); /
if(aDSNCreated == false)
{
retcode = SQLInstallerError(2, NULL,NULL,100,NULL);
}
Am i doing anything wrong,please help me
Thanks
Manju
|
|
|
|
|
Have you tried:
SQLConfigDataSource(NULL, ODBC_ADD_DSN, "SQL Server (*.MDF)", _T("DSN=Login\0DBQ=E:\\Login_Data.MDF\0"));
What does SQLInstallerError() have to say?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
I have a Dialogue and a Button "Open".I want when i click on "Open" Button,an other application will open.I know MFC guide to use CreatProcess Function but i don't know how to add this function into "Open" Clicked event. Please help me.
Example i have:
void CThunghiemDlg::OnButtonOpen()
{
}
|
|
|
|
|
I think the above comment makes it fairly clear what you need to do. Just add the code to run the external application. Or have I misunderstood your question?
The best things in life are not things.
|
|
|
|
|
My question is how to call a application (example FireFox.exe) when i click in "Open" Button on Dialogue.I don't know use CreateProcess in function : "void CthunghiemDlg::OnOpen" because CreateProcess is function return Bool Value,and with what value of this function is a application called?
|
|
|
|
|
camuoi288 wrote: .I don't know use CreateProcess
All explained here[^].
camuoi288 wrote: because CreateProcess is function return Bool Value
This is merely a value to tell you whether CreateProcess() succeeded or not.
The best things in life are not things.
|
|
|
|
|
|
What exactly don't you know? As you said it you'd have to add the code for creating a process in the button click event handler.
|
|
|
|
|
Example i want to call InternetExplorer.exe when i click on "Open" button,so what code i need add to "void CthunghiemDlg :: OnOpen".
Because CreateProcess is function return Bool Value.
|
|
|
|
|
Simple Example of CreateProcess
DWORD g_nRetVal = 0;
DWORD g_nWaitCode = 0;
HANDLE g_hWaited = NULL;
DWORD WINAPI RunUtils(void *pParam) {
LPCTSTR szExe = TEXT("Path of executable");
LPTSTR szParams = TEXT(" /d C:");
HANDLE hEvent = NULL;
PROCESS_INFORMATION ProcessInfo;
ZeroMemory(&ProcessInfo, sizeof(ProcessInfo));
STARTUPINFO StartupInfo;
ZeroMemory(&StartupInfo, sizeof(StartupInfo));
StartupInfo.cb = sizeof(StartupInfo);
StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow = SW_HIDE;
hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
if (CreateProcess(szExe, szParams, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &StartupInfo, &ProcessInfo)) {
g_nWaitCode = WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
switch (g_nWaitCode) {
case WAIT_OBJECT_0:
GetExitCodeProcess(ProcessInfo.hProcess, &g_nRetVal);
break;
case WAIT_FAILED:
g_nWaitCode = GetLastError();
break;
}
::CloseHandle(ProcessInfo.hProcess);
::CloseHandle(ProcessInfo.hThread);
ResetEvent(hEvent);
HWND hWnd = (HWND) pParam;
SendMessage(hWnd, WM_USER_THREAD_WAITED, 0, 0);
}
return 0;
}
void CThunghiemDlg::OnButtonOpen()
{
HANDLE hExecThread = NULL;
if(m_bCleanUp)
{
hExecThread = CreateThread(NULL, 0, &RunUtils, (LPVOID) m_hWnd, 0, NULL);
}
}
You can do the same by using ShellExecute
void CThunghiemDlg::OnButtonOpen()
{
ShellExecute(NULL, "open", "path of executable", NULL, NULL, SW_SHOWNORMAL);
}
"Every Little Smile can touch Somebody's Heart...
May we find Hundreds of Reasons to Smile Everyday... and
May WE be the Reason for someone else to smile always!" (ICAN)
|
|
|
|
|
I want to ask:
"m_bCleaup variable and WN_USER_THREAD_WAITED variable".How are they declared?and how to use them?
|
|
|
|
|
no need to use these variable.
"Every Little Smile can touch Somebody's Heart...
May we find Hundreds of Reasons to Smile Everyday... and
May WE be the Reason for someone else to smile always!" (ICAN)
|
|
|
|
|
Hi,
i want to access any windows DOM like in javascript(DHTML).
Is that possible? if so then please give me references, links and suggestions.
|
|
|
|
|
The question is little bit confusing, Are you looking to access the HTML page from IE window and trying to read the HTML tag?
|
|
|
|
|
I want to write a program which will access any other windows DOM for example Internet Explorer and its html components like text box, radio button and so on.
And also firefox or any other browser.
Besides i want to access desktop application's objects similar to html DOM.
Hope i had made it clear.
Even the taskbar, the start button, the tray icons.
If you could assume the desktop as an html page and then i want access all like what we do in dhtml.
|
|
|
|
|
Your requirement is quite huge, for Browsers you can Look for Browser Helper Objects ( BHO ) for IE you can get started with Popup Window Blocker[^] article. XPCOM for Mozilla browsers.
On taskbar, start button and tray button, I am not sure what is the intention of developing such application. MSAA[^] can give you some idea.
HTH
|
|
|
|
|
Hi ,
I have created sample application which opens the serial COM Port and tried to write and Read the data.
I have used CreateFile () method to open the COM1.
hCom = CreateFile (pcCommPort,GENERIC_READ | GENERIC_WRITE,0,NULL, OPEN_EXISTING, 0,NULL );
Then I set the COM state
GetCommState( hCom, &lpCC.dcb);
lpCC.dcb.BaudRate = CBR_9600;
lpCC.dcb.StopBits = ONESTOPBIT;
lpCC.dcb.ByteSize = 8;
lpCC.dcb.Parity = NOPARITY;
lpCC.dcb.fBinary = TRUE ;
lpCC.dcb.fParity = TRUE ;
SetCommState( hCom, &lpCC.dcb );
I am trying to write the data using
WriteFile (hCom,(LPCVOID)ptr,20,&byteswritten,NULL);
and trying to read the data using
ReadFile (hCom, (LPVOID)ptr, 20, &dwBytesTransferred, 0);
ptr is pointer to the BYTE array. The above code of "ReadFiles() returns true and Reads Junk characters. I have written exact 20 characters through WriteFile() and it returned TRUE . I am not able to figure out the exact problem . Please provide any input in this regards.
Thanks
|
|
|
|
|
pandit84 wrote: ...and Reads Junk characters.
How are you verifying this?
Do you know that data is available to read before calling ReadFile() ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
I am printing the ptr using printf statement.
|
|
|
|
|
if you're doing this between two computers, you are using a null-modem cable?
|
|
|
|
|
I have not yet tried this on two computers. I am using only one computer to test.
|
|
|
|