|
One standard way I use to stop the OK button closing the dialog unless it has the focus is:
void CMyDialog::OnOK()
{
if (GetFocus() == GetDlgItem(IDOK))
EndDialog(IDOK) ;
}
Roger Allen
Sonork 100.10016
I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.
|
|
|
|
|
Thats a great trick! Thank you so much! This does mean however , that the ok button HAS to be pressed to exit, right? I wanted Enter to exit me too, but only if I had written into an CEdit...
But your solution looks good, so thank you very much!
Appreciate your help,
ns
|
|
|
|
|
Does anyone know how to add features to an existing control panel applet? I am writing a program that includes features closely tied with the properties of the Telephone applet of windows, and I would like to add to the property sheet or append a dialog to the existing dialog. Any idea how I might approach this problem?
|
|
|
|
|
The Telephony applet (Phone/Modem options) is controlled via TAPI.
The function lineTranslateDialog is used to display this dialog in your own application. It is possible to add custom pages via the TSPI for a telephony device.
From MSDN
Assume for the purposes of an example that the application calls the TAPI lineConfigDialog function, which is designed to open a dialog box to allow configuration of service provider options related to the specified line device. In response to this call, TAPI requests TAPISRV to call TSPI_providerUIIdentify in the telephony service provider, obtaining the name of the TSP UI DLL.
In the application's context, TAPI loads the TSP UI DLL and calls the TUISPI_lineConfigDialog function with the parameters supplied by the application, and including a pointer to the TAPI TUISPIDLLCALLBACK function. The TSP UI DLL displays the configuration dialog box, calling the TUISPIDLLCALLBACK function as necessary to obtain from the telephony service provider the information to display. Each time the TUISPIDLLCALLBACK function is called, TAPI requests TAPISRV to call the telephony service provider's TSPI_providerGenericDialogData function, passing in the parameter block from the UI DLL, and returning the parameter block to the UI DLL. The UI DLL conveys any configuration changes to the telephony service provider by calling TUISPIDLLCALLBACK.
When the function is complete, the UI DLL returns from (in this case) TUISPI_lineConfigDialog. TAPI calls the Win32 FreeLibrary function to release the UI DLL, and returns to the application.
Michael
"I've died for a living in the movies and tv.
But the hardest thing I'll ever do is watch my leading ladies,
Kiss some other guy while I'm bandaging my knee."
-- The Unknown Stuntman
|
|
|
|
|
Thanks Michael! I'll have to study it for a while before I can tell if it would be useful to me. Can you tell me where the MSDN article comes from and where I might find other resources or the sort? thanks!
-Leo
http://LessExpense.tripod.com
|
|
|
|
|
Its under the Telephony Application Programming Interface on the Platform SDK.
There is a section called TAPI Service providers and a sub section of The Telephony Service Provider UI DLL Interace.
Michael
"I've died for a living in the movies and tv.
But the hardest thing I'll ever do is watch my leading ladies,
Kiss some other guy while I'm bandaging my knee."
-- The Unknown Stuntman
|
|
|
|
|
Hi,
I'm trying to compile a game from a textbook, and I get this link error:
libcd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
This is supposed to mean that the VC-6.0 file libcd.lib erroneously uses the symbol _main which of course seems extremely unlikely.
If I compile a Release version I get the same error but now against libc.lib.
I'm using VC 6.0 under Windows 98. The program uses directX and I put the proper libraries on the link list. Also, I copied in the author's code, so it's not a typo.
I think I must have some compiler/linker setting wrong. Any ideas?
Al
|
|
|
|
|
The libcd.lib is the debug version of the C-runtime and the libc.lib is the release version. The C-runtime library expects that main() function to be present as the entry point to your application. When your program gets started up, the C-runtime will first be initialized, then it will forward execution to main so that your program can start running.
Check in your project settings, under the C++ tab. If ATL is used in this Demo and _ATL_MIN_CRT is defined, that would cause this problem.
If that does not solve your problem, what kind of application is it. Does it use ATL, MFC or straight WIN32 API? This information would be useful in helping you solve your problem.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
You need /subsystem:windows in the link command.
Chances are, that will cause other error messages though. You may want to use the App Wizard to create an empty Win32 application, then add your source files to the project.
--------
There are 10 types of people in this world. Those who know binary and those who don't.
|
|
|
|
|
I'm creating and populating a database with ADO and ADOX. Now the very first time I do this and create a brand new database, things are fine. If I try to overwrite an existing database, I get "permission denied" . I close the database when I exit, so that should be fine. Any ideas at what I should look at here? Its an access database with one table.
Appreciate your help,
ns
|
|
|
|
|
If you want to create a database with ADOX and the database exists, First you need to delete the file, then you must to create the database..
Regards...
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
However I AM deleting the old database in code. An earlier version works, and in the newest dll, I put in a few extra input parameters which I guess are somehow causing the problem. Basically now its adding two new columns to the database. The first time around, with a brand new db, all is fine...I guess I'll have to put some messageboxes in the dll to see where its unhappy...
Appreciate your help,
ns
|
|
|
|
|
AAargh! THe problem has miraculously disappeared. This makes me very nervous. All I did was rebuild the dll, and now it is doing fine...
Appreciate your help,
ns
|
|
|
|
|
it's a kind of magic....
Sometimes that happens....
Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Problems that go by themselves come back with friends...
"In an organization, each person rises to the level of his own incompetence." Peter's Principle
|
|
|
|
|
dreading it...
Appreciate your help,
ns
|
|
|
|
|
Hi,
I looked at the code of some VC++ macros (DSM files). It's pretty simple, but is there a documentation about the various objects (example : ActiveProject) and methods you can use, that are specific to Visual C++ ?
Or do you need Visual Basic to help you with members listing and auto-completion ?
Thanks,
Thibaut
|
|
|
|
|
I've never used one before. I need a link to a simple example that shows how to use it. I need to start with no items in the dropdown, but as the user enters them in the edit portion, they should get added to the dropdown part> then if you so choose, you should be able to click on an entry which should then show up in the editbox part. I need to see how to get this simple functionality. Code on CP seems very advanced, and I'm wondering if theres a simple example of using a combobox
Appreciate your help,
ns
|
|
|
|
|
Buy this book "Programming Windows with MFC[^]" Jeff Prosise.
That's what you need if you are willing to learn well, add skills, and accelerate.
She's so dirty, she threw a boomerang and it wouldn't even come back.
|
|
|
|
|
You can try this...
CString s;
m_Combo.GetWindowText(s);
m_Combo.InsertString(0,s);
m_Combo.SetWindowText("");
m_Combo.SetFocus();
You can put something like this on a button (Add) or you can overide the OnKeyPress or Pretranlatemessage to do it whem you press the ENTER
Casa.Sapo.pt
|
|
|
|
|
That helps me on my way! Thanks a bunch!
Appreciate your help,
ns
|
|
|
|
|
Hi,
I'm sending queries to many game servers via UDP in a for -loop. But in the receive function there seems to be a problem:
void CMainFrame::OnReceiveUDP()
{
SOCKADDR_IN fromAddr;
int fromSize = sizeof(fromAddr);
TCHAR pkt[PACKETLEN];
int respStringLen = m_sSocket.ReceiveFrom(pkt, PACKETLEN-1, (SOCKADDR*)&fromAddr, &fromSize, 0);
if(respStringLen == SOCKET_ERROR)
{
CString string;
string.Format("CUDPSocket::ReceiveFrom() failed\nReason: %i", GetLastError());
MessageBox(string, "Error", MB_OK|MB_ICONSTOP);
return;
}
else
{
CListView* pView = (CListView*)GetActiveView();
CListCtrl &list = pView->GetListCtrl();
list.InsertItem(idx, pkt);
idx++;
}
}
But after about 30 servers I only have garbage characters in the variable pkt , although the servers send normal packets. How can this happen?
thanks in advance
Greg
modified 12-Sep-18 21:01pm.
|
|
|
|
|
|
for(int i=0; i<servercount; i++)
{
CServer server = arServers.GetAt(i);
if (m_sSocket.SendTo("\\status\\", 8, server.QueryPort, server.IP, 0) != 8)
{
}
}
arServers is an CArray of servers
I know this code is crappy, but I don't know how to make it better.
reagrds
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi !!
I started with VC6 a simple console application. The project is emtpy, I just have an empty main() and and include of stdafx.h.
Now, I'd like to use some functions of the Win32 API (ShellExecuteEx for instance), but I have no idea which headers I have to include. I checked in the msdn but didn't find anything.
When I try to compile, even basic windows types like DWORD are not declared.
Does anyone could tell me where, for each Win32 functions, I can find exactly which lib and which header file I have to add to my project ?
Thanks !
Jerome
|
|
|
|