|
i want to know how can i can the api of some executable or better some component of windows.... i want to host some of the windows component in my mfc application... how can this be done...
tHeStRaT
|
|
|
|
|
thestrat wrote: i want to host some of the windows component in my mfc application
For showing most of the windows components there are functions. For eg to create a new network connection you have to call the HomeNetWizardRunDll() function in the hnetwiz.dll. What i did to find this function is that. Take the windows help, search for "Network Setup Wizard". In some results you will find a link to "Network Setup Wizard" right click on it and take properties. then you can find the dll name and the function of it. like..
ms-its:C:\WINDOWS\Help\network.chm::/EXEC=,rundll32.exe,hnetwiz.dll HomeNetWizardRunDll
hope this helps...
|
|
|
|
|
Hello All,
I have the source code of a dll and i am supposed to re-write it.
This dll uses COM. (It has COM Interfaces and will invoke a COM exe as well).
Now, looking at the source code, how can i figure out the project settings with which it was created ?
These are some of the details which i want,
* Is it a ATL COM AppWizard or MFC AppWizard dll.
* If ATL COM AppWizard, is it been developed with MFC Support or not ?
* If MFC AppWizard dll, is it a Regular Dll with MFC Statically Linked or Regular Dll using shared MFC dll or MFC Extension Dll ?
How do i get these information from the source code ?
Thanks
|
|
|
|
|
Hi,
If dll uses COM component than it is ATL Com appwizard and when u create new workspace than option of MFC support is also displayed. u may select MFC support and than create workspace
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
user3034 wrote: Now, looking at the source code, how can i figure out the project settings with which it was created
If by "source code," you strictly mean the cpp and h files, you can't. You need the project file, which, IMHO, is part of the source code, just like Makefiles back in the old days. For VC 6, you're looking for the .dsw / .dsp file; for 2005, the .sln / .vcprog
Judy
|
|
|
|
|
Hi,
Using VC++, MFC How to Create Activex and Talk with C#? Any Idea..Reply Me..
Any tutorial For VC++(MFC)??
|
|
|
|
|
In VC++ 6.0 you will find an ActiveX control wizard from there you can create any sort of AX u want.
try this out and get back to me I shall guide u.
|
|
|
|
|
See such code:
[1]: std::string *strTemps=new std::string[2];
[2]: delete strTemps;
it would crash at the line [2].But if I chang the code like bellow:
[1]: std::string *strTemps=new std::string[2];
[2]: delete [] strTemps;
It will work will now.
Someone would like to tell me, why?
Thanks.
GOOD LUCK.
|
|
|
|
|
If you allocate an array with new, then you should deallocate an array also. When you use new[], some information will be put in front of your pointer to hold the number of elements you allocate. So, you really need to match new with delete and new[] with delete[], otherwise you'll get a crash.
|
|
|
|
|
I agree what you said.
But this code:
struct T{
int m;
int n;
};
[1] int* int_array=new int[4];
[2] delete int_array;
[3] struct T *t=new T[4];
[4] delete t;
The code will work well.
Why,now?
Thank you.
|
|
|
|
|
Because you are just being lucky . It is not because it doesn't crash that your code is correct. You will probably have some memory leak also: the delete expect to free only one element, so, only the space for one element will be deallocated, resulting in a memory leak.
|
|
|
|
|
I hope so.
And I will follow your guideline in future.
Thank you very.
Have a good day.
|
|
|
|
|
I have done an untitled dialog box in MFC,
Clicking on this dialog button on taskbar, window does not minimize or maximize.
To handle this i have written code in OnNcActivate message.
My problem is that, when i say ShowWindow(SW_SHOWNORMAL); at that time the window
is shown but again it gets minimized. It does not get hold.
Please try the code, let me know what is the problem.
Here is the following code
BOOL CRestoreDlg::OnNcActivate(BOOL bActive)
{
BOOL b2 = FALSE;
TBBUTTON tbButton;
HWND hWndBut = NULL;
WINDOWPLACEMENT wndpl;
HANDLE hProcess = NULL;
LPVOID lpRemoteBuffer = NULL;
DWORD dwProcessId = 0, dwThreadId = 0;
memset(&wndpl, 0, sizeof(WINDOWPLACEMENT));
memset(&tbButton, 0, sizeof(TBBUTTON));
GetWindowPlacement(&wndpl);
HWND hDesktop = ::GetDesktopWindow();
HWND hTray = ::FindWindowEx(hDesktop , 0, _T("Shell_TrayWnd"), NULL);
HWND hReBar = ::FindWindowEx(hTray, 0, _T("ReBarWindow32"), NULL);
HWND hTask = ::FindWindowEx(hReBar, 0, _T("MSTaskSwWClass"), NULL);
HWND hToolbar = ::FindWindowEx(hTask, 0, _T("ToolbarWindow32") , NULL);
LRESULT count = ::SendMessage(hToolbar, TB_BUTTONCOUNT, 0, 0);
dwThreadId = GetWindowThreadProcessId(hToolbar, &dwProcessId);
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessId);
if (NULL == hProcess)
{
return FALSE;
}
for (int i= 0 ; i < count ; i++ )
{
memset(&tbButton, 0, sizeof(TBBUTTON));
lpRemoteBuffer = VirtualAllocEx(hProcess, NULL, sizeof(TBBUTTON), MEM_COMMIT, PAGE_READWRITE);
if (NULL == lpRemoteBuffer)
{
return FALSE;
}
::SendMessage(hToolbar, TB_GETBUTTON, i, (LPARAM)lpRemoteBuffer);
b2 = ReadProcessMemory(
hProcess,
lpRemoteBuffer,
(LPVOID)&tbButton,
sizeof(TBBUTTON),
NULL);
if (FALSE == b2)
{
return FALSE;
}
BYTE localBuffer[BUFFER_SIZE];
BYTE* pLocalBuffer = localBuffer;
DWORD_PTR ipLocalBuffer = (DWORD_PTR)pLocalBuffer;
pLocalBuffer = localBuffer;
ipLocalBuffer = (DWORD_PTR)pLocalBuffer;
DWORD_PTR lpRemoteData = (DWORD_PTR)tbButton.dwData;
ReadProcessMemory(hProcess, (LPVOID)lpRemoteData, (LPVOID)ipLocalBuffer, sizeof(DWORD_PTR), NULL);
HWND windowHandle;
memcpy(&windowHandle, (void *)ipLocalBuffer, 4);
if (windowHandle == m_hWnd)
{
if (tbButton.fsState & TBSTATE_PRESSED)
{
if (wndpl.showCmd == SW_SHOWMINIMIZED)
{
ShowWindow(SW_SHOWNORMAL);
}
else if (wndpl.showCmd == SW_SHOWNORMAL)
{
ShowWindow(SW_SHOWMINIMIZED);
}
}
}
VirtualFreeEx(hProcess, lpRemoteBuffer, 0, MEM_RELEASE);
}
CloseHandle(hProcess);
return TRUE;
}
|
|
|
|
|
If the winow is created with out the WS_MINIMIZEBOX, style your window cannot be minimized. then why are you doing all this?
|
|
|
|
|
Dialog box tilte bar is removed from property of dialog box, and own title bar is set with min/max buttons.
When default title bar is removed, dialog window does not minimize/maximize from taskbar button.
We have to handle this, I have tried to do it in OnNCActive message. It is not working fine.
If any idea about it, please help
|
|
|
|
|
I just tried this and got a very simple solution. Add the following code in the OnInitDialog() function. Even if the window dosent have the titlebar, if you specify this style the minimize/restore is working
ModifyStyle( 0, WS_MINIMIZEBOX );
|
|
|
|
|
Thank you. It has worked.
|
|
|
|
|
Thank You. It has worked.
|
|
|
|
|
Hello all,
I have made a worker thread (which is running 10 times simultaneously) in which i am displaying a messagebox. I want that when a message window is open second message window shouldn't popup.
Can anybody help me in this.
Thanks in advance.
|
|
|
|
|
|
neha.agarwal27 wrote: I have made a worker thread (which is running 10 times simultaneously) in which i am displaying a messagebox.
Why? That pretty much goes against the grain of what a worker thread is meant for.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
anybody pls give me a suggestion.
i already developed communication b/w two systems by RS-232(9pin)port.
nw i want 2 prepare communication b/w Pc and Modem.
when ever i hit a AT commands to Modem from my dailog...then Modem response is also be displayed in my Dailog box....
kp
|
|
|
|
|
Yes, and what's the exact question ? Where are you stuck exactly ? You already asked a similar question yesterday and you got some answers, so where is the problem ?
(And please, avoid using SMS language, because it is quite difficult to read for non native english speakers).
|
|
|
|
|
Mr.Moonen sir thankyou for your's reply.
i created a port configarations using combo box and i created a "openport" button.and port also opened.
after this in i created a two editboxes, one for ATcommands to Modem and other for Responses from modem like When Hyper terminal.
exactly here iam not getting any idea.how send commands to modem and getting responces from modem to our editbox.
i think u can understand my problem.
kp
|
|
|
|
|
Once you opened the port with CreateFile, you can use ReadFile to read data from the serial port and WriteFile to write data on the port. Take a look at this article[^] for complete information.
Take a look also at this section[^] that contains several articles about serial port communication (and some wrapper classes too, to make your life easier).
|
|
|
|
|