|
You can use a ComboBox for the adressbar and insert the adress with m_myCbo.Addstring() . If you want to show the adresses which are inserted before and you run the programm again write it into the registry or in an *.ini-file with WriteProfileString and GetProfileString() .
Example:
<br />
CString strSection = "My Section";<br />
CString strStringItem = "My String Item";<br />
CString strIntItem = "My Int Item";<br />
<br />
CWinApp* pApp = AfxGetApp();<br />
<br />
pApp->WriteProfileString(strSection, strStringItem, "test");<br />
<br />
CString strValue;<br />
strValue = pApp->GetProfileString(strSection, strStringItem);<br />
ASSERT(strValue == "test");<br />
<br />
pApp->WriteProfileInt(strSection, strIntItem, 1234);<br />
int nValue;<br />
nValue = pApp->GetProfileInt(strSection, strIntItem, 0);<br />
ASSERT(nValue == 1234);<br />
The ini-file got the name of your programm and you can find it under C:\Windows\ or C:\Winnt\.
PR
|
|
|
|
|
1. Create the address bar like dialog window in Resource editor. Set the style CHILD and border NONE.
2. In CMainFrame class declaration add:
CDialogBar m_wndAddressBar;
CReBar m_wndReBar;
3. In CMainFrame::OnCreate() add:
m_wndAddressBar.Create(this, IDD_ADDRESSBAR, CBRS_ALIGN_TOP, AFX_IDW_DIALOGBAR);
m_wndReBar.Create(this);
m_wndReBar.AddBar(&m_wndAddressBar);
The IDD_ADDRESSBAR is the resource ID of your address bar in Resource editor.
Robert-Antonio
|
|
|
|
|
|
Hello all
Is there any function to findout the version information of a DLL programatically. Pls help..
Thanks
Hari.
|
|
|
|
|
|
There sure is. The function is defined in <shlwapi.h> which is part of the Platform SDK.
<code>
HRESULT CALLBACK DllGetVersion(DLLVERSIONINFO *pdvi);
</code>
Hope this helps.
|
|
|
|
|
Thank you very much for the replies.
|
|
|
|
|
This is not an API routine, it is a routine that must be implemented by the DLL.
MSDN:
This function is not an API. It is exported by name from each DLL that implements it. Currently, most of the Windows Shell and common controls DLLs implement DllGetVersion. These include, but are not limited to, Shell32.dll, Comctl32.dll, Shdocvw.dll, and Shlwapi.dll.
It will not work on all DLLs.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Hi
Anyone have a example of SendKey. Peter and I are working on my project and I need some help. I want to sendkey to a window I have a handle for. Thanks to Peter I have enumed all the top level windows, now I need help with SendKey. Will this project ever end?
Best Wishes,
ez_way
|
|
|
|
|
It depends on what kind of keys you want to send... This is just a sample:
// suppose your window handle is hwnd, you want to send key "A" to it.
::PostMessage(hwnd, WM_CHAR, WPARAM('A'), LPARAM(0));
|
|
|
|
|
Thank you, very helpful!
I am sending
::PostMessage(hwnd, WM_CHAR, WPARAM('^'), LPARAM(M));
Ctrl+M
Best Wishes very good~!
Best Wishes,
ez_way
|
|
|
|
|
Is there an easy way to display incoming video(like from a camcorder)on a computer using visual C++ or visual basic?
Thank you
|
|
|
|
|
|
Well the DirectShow API of the DirectX 8 and up are surprisingly not that challenging to learn. The documentation provided with the SDK will have you displaying all kinds of streams in no time. Personally I developed a VERY basic TV Viewing application in 2 days from scratch (I knew nothing about DirectShow before)
|
|
|
|
|
If you ever download the VS6 samples, about 100megs from msdn, it has a lot of cool things... including wordpad yes the 95 version although there is no difference, lol with the new and old one (95 and xp)... to find this, open the c++ documentation go to mfc samples, go to mfc ole samples and out of the list should be displayed wordpad, yes with all the source code, you can compile it, alter it... unless windows made it so if it is changed it will report you, jk . neat little things can be found by looking at and remembering old stuff.
Actual Linux Penguins were harmed in the creation of this message.
|
|
|
|
|
Hello everyone:
I want to transfer a function pointer from a wtl project to a MFC dll.
Do I need to make the function as a callback function?
How to do?
If having some sample code, please email to me .
Thank you.
-Freehawk.
|
|
|
|
|
Hi guys, I do need your suggestions.
In document based MFC application, there is a menu item “ID_FILE_OPEN”. When you press it, it will run cWinApp::OnFileOpen.
Now, I have a dialog based MFC application. I want to add a button to achieve above function. When I press the button, it can open a file explorer or file manager.
By the way, this MFC application doesn’t have StdAfx files.
What I should do?
|
|
|
|
|
Add an event handler for the button click event. Then use the CFileDialog class to prompt the user to select a file to open. From here it depends on how you have the data saved (serialized). You will have to supply your own file reading function. You can use the CFile class to open and read the file data or the ansi fopen, fread functions.
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
allrighte... If I get it, you want a button that will do exactly as if you'd press file->open?
Simple: create that button, then set its ID at ID_FILE_OPEN. It's that simple...
again.. I hope I got it right..
HTH,
Andrei.
|
|
|
|
|
I have a small dialog-type MFC App
In order to not exit the app if I press ESC or Enter I wrote this:
void CVariantDlg::OnOK(){}
void CVariantDlg::OnCancel(){}
In other words I overloaded the functions OnOK() and OnCancel(). It worked! Now I can press ESC or Enter and the app won't close.
My problem is that even if I hit ALT-F4 or right-click it on the taskbar and choose close or hit the x button in the right side of the title bar it won't close!
This sucks. I guess I should check to see what are the latest keys pressed and choose from that point on.
BTW: How did you call the original function from the overloaded version of it?
Anyways... what do you recommend me in order to have the application exit on:
a) X button from title bar
b) ALT-F4
c) Close from the system menu / taskbar rightclick and "Close"
But not:
a) ESC
b) ENter
? TIA!
|
|
|
|
|
Let the user use ESC or Enter, after all that is what most user will expect.
Otherwise you could probably use GetKeyState() to determine which key was pressed, so you can decide when to allow box to close.
INTP
|
|
|
|
|
THANKS!
It worked!
If GetKeyState(VK_ESCAPE) is -127 or -128 then the user pressed ESC and I will NOT exit the app. Otherwise yes.
|
|
|
|
|
Try to leave OnOK and OnCancel like before,
just overload OnClose function like this :
OnClose
{
CDialog::OnOK();
}
rrrado
|
|
|
|
|
Override a PreTranslateMessage :
BOOL CVariantDlg::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN)
{
WORD wKeyCode = LOWORD(pMsg->wParam);
if ((wKeyCode == 13) || (wKeyCode == VK_ESCAPE))
return TRUE;
}
return CDialog::PreTranslateMessage(pMsg);
}
Robert-Antonio
|
|
|
|
|
Please don't flame me (too much)... I am still a beginner.
I have a dialog type MFC app with 1 string table. I added there strings for all controls and visual messages to the user. All these in order to make my app multi-language prepared.
I thought this way: "I have default strings for everything. Then I try to load a language.ini file and overwrite every string in the string table with the ones that I read from the ini file. This way if the ini file is incomplete, I won't have textless controls or messages"
My problem is that I don't know how to :
a) Modify (IF POSSIBLE?) a string stored in a string table
b) Use a string from the string table as a parameter to a function that requires one. For example for MessageBox.
Thank you.
PS: One way to do b) that I found is:
CString test;
test.LoadString(IDS_STOP);
MessageBox(test,"abc",MB_OK);
Only I fear that there is a simpler way.
|
|
|
|