|
Check out this article, as well as this one.
Shog9
I'm not the Jack of Diamonds... I'm not the six of spades.
I don't know what you thought; I'm not your astronaut...
|
|
|
|
|
i am currently handling a project using window programming that also support client server technology. in my project, i need to assure when a client click on the menu, the server will do what the client request. i just couldnt figure how to run few client programs that can control the server program. if multiple giving commands at the same time. what will happen. i really have no idea. hope someone can help me.
blurblur kf
|
|
|
|
|
Hi!
is there some kind of events we can use to know when a new process is running?
thanks!
|
|
|
|
|
Can any body give me a how or a sources code to implement a right click function which show a drop down menu on item in ClistCtrl ??
Nobody is Lonely
|
|
|
|
|
catch the Right Button Click on CListCtrl and using TrachPopupMenu api display the Menu on the CListCtrl.
just Check the documentation of TrackPopupMenu in local copy of MSDN it's contain the example for displaying the popupmenu
"I Think this Will Help"
<h5
alok="" gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
i have add this command from msdn library, but it have some errors...
void CMCSProjectDlg::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CView::OnRButtonDown(nFlags, point);
CMenu* menu_bar = AfxGetMainWnd()->GetMenu();
CMenu* file_menu = menu_bar->GetSubMenu(0);
ASSERT(file_menu);
file_menu->TrackPopupMenu(TPM_LEFTALIGN |TPM_RIGHTBUTTON, point.x,
point.y, this);
}
ERROR:
error C2248: 'OnRButtonDown' : cannot access protected member declared in class 'CWnd'
: see declaration of 'OnRButtonDown'
: error C2352: 'CWnd::OnRButtonDown' : illegal call of non-static member function
: see declaration of 'OnRButtonDown'
Error executing cl.exe.
What d' problem ??
Nobody is Lonely
|
|
|
|
|
Hello everyone.
I have a dialog attached in a frame, the propery of dialog is "child", in the dialog there are some edit boxs, comboboxs and buttons. When these controls in dialog got focus, I want to catch the active event. I tried to add WM_ACTIVE to dialog, but it can not be called. How to know when the dialog is activated?
Thanks.
-Freehawk
|
|
|
|
|
When these controls in dialog got focus, I want to catch the active event.
for that u can use EN_KILLFOCUS and EN_SETFOCUS events of edit box
|
|
|
|
|
How can I connect to a SQL/MSDE database. I figured I couldn't use CDaoDatabase since it's not an Access database that I want to connect to. Is this the connection I should use?
strConnect = _T("Provider=sqloledb;Data Source=MyServerName;"
"Initial Catalog=MyDatabaseName;"
"User ID=myUsername;Password=myPassword;");
Now how do I use this string to connect and query my database?
Thanks!
|
|
|
|
|
Have you considered using ADO?
|
|
|
|
|
Yes but isn't using ADO in C++ very complex? My program isn't COM-based so it may be a little difficult to implement. Are there other alternatives to using ADO?
|
|
|
|
|
I'm using ADO in my app and to be honest I don't even know what COM is. I didn't find it very difficult, I'm not aware of easier alternatives (but I'm no expert). This article was very helpful to me:
http://www.codeproject.com/database/simpleado.asp[^]
If you have any more questions I'd be glad to help but we should probably move this over to the SQL/ADO/ADO.NET message board.
|
|
|
|
|
Thanks Wilsonian! I'll try it out and if I'm still having problems I'll post it in the SQL/ADO/ADO.NET board. Thanks again!
|
|
|
|
|
Hello,
I'm using the following code to create database programatically, and it works only on WinXP, it crashesh on win98/ME/2000:
CDaoDatabase db;<br />
db.Create(_T("tmp.udb"));<br />
CDaoTableDef TableDef(&db);<br />
TableDef.Create(_T("Addresses"));<br />
TableDef.CreateField(_T("AddressID"), dbLong, 4, dbAutoIncrField);<br />
TableDef.Append();<br />
db.Close();
with error from daocore.cpp -> line:453
What am I doing wrong?
|
|
|
|
|
Im looking for a method of get the effective size of a dinamic array created with the new statement, because the sizeof instruction only gives me the size of the pointer or the size of the first element of the array, maybe that i don't know how use that, but i really want to know the size of an array without having the number of elements of the array, (if it's posibble) the same as UBound property in VB6.
PS: excuse if this text is a little confuse, i'm from argentina and my english is basic.
Thanks
|
|
|
|
|
Either the class that you use to create your dynamic array has member functions to check the size, or it doesn't. What class are you using to create your dynamic array?
|
|
|
|
|
What i want to do is something as:
char c[255];
int size;
int * myArray=new c;
size=Ubound(myArray); // this is the function what i like
// I do it any times and i want to know it size
// I need to know the lenght of the array, then i know if i can add another
// to the array.
|
|
|
|
|
The C++ inside me says:
Better to use some class for holding the array (what about ready-to-use stl::vector ?) that could return you the size of the array by using something line myArray.size() ? You will also get the automated memory management included and many more other stl usefull functions.
The C devil says:
on most compilers, the size of the array is stored at some negative offset of the array (but differs on compilers, also can differ on compiler versions etc - simply don't try it at home, it's ugly ugly ugly hack - just mentioned in case of emergency)
|
|
|
|
|
What you are after is not possible. You could pull it off while in debug mode, but the same trick would not work in release mode.
When you dynamically allocate memory, the amount requested is usually stored in a variable or a #define directive.
char *buff = new char[255]; Now whenever buff is used by other functions, the value 255 must also be sent to those functions. Make sense?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi Guys
I have to convert a IP-Address which is a CString to an UInt, but i have no clue how to do this. Also i must convert a Port CString to an UInt.
MFG
RedDragon2kx
Unix and C are the ultimate computer viruses.
|
|
|
|
|
don't you use a class that use ip addresses, and in which some function take a string (either char* or std::string or CString...) ?
else, you might write your own function that test first the validity of the address, and then, extract it to a UInt...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
You can sscanf the string like so:
CString sIPAddr;
UINT nByte1, nByte2, nByte3, nByte4;
UINT nPort;
DWORD dwIPAddr;
int nArgs = sscanf( (LPCTSTR)sIPAddr, "%d.%d.%d.%d:%d",
&nByte1, &nByte2, &nByte3, &nByte4, &nPort );
if( nArgs != 5 )
{
}
else
{
...
...
dwIPAddr = (nByte1 << 24) + (nByte2 << 16) + (nByte3 << 8) + nByte4;
}
You may want to verify my byte ordering (nByte4 may be the high byte) when building the dwIPAddr, but this should do the trick.
Bob Ciora
|
|
|
|
|
Thx. That fixed my problem.
Unix and C are the ultimate computer viruses.
|
|
|
|
|
For future reference, take a look at the inet_addr function in the MSDN library. I can't believe there isn't built in global c runtime functions for parsing an IP address in this day and age. But if you are programming with MFC or windows, you can use this windows function.
I hate the sscanf method myself. It seems wonderful on paper but there seem to be all kinds of weird issues when I try to use it. It never worked well for me as a validation tool for any kind of number. I always use the cruntime methods such as strtod for taking strings and validating them as actual numbers and converting them into an int value (for instance). Unfortunately, I don't see a c-run time method for IP addresses that would be more portable. Since I am a windows programmer, I have to settle for the windows libraries to provide this capability.
Shawn
|
|
|
|
|
Question. I have been doing c++ code for sometime now but only in console code. I am starting now to use MFC and I wanted to convert my old Console code into GUI MFC code. My Code relies heavily on Stream I/O with strings and character arrays, but I am having a problem getting my character arrays to output to my GUI correctly. I keep getting assertion errors when when running the program (NOTE: the program compiles error free).
Here is an example of what works:
void CParserDlg::OnParse()
{
char key[16]; //Make Array "Key"
strcpy(key, "Text Here"); //Copy "Text Here" into array
UpdateData(TRUE); //
m_strkey.Format(key); //Send String to Dialog Box
UpdateData(FALSE); //
}
This works fine and outputs the string "Text Here" to the dialog box. Now if I try and output 1 character and not the whole thing I get an assertion error:
void CParserDlg::OnParse()
{
char key[16]; //Make Array "Key"
strcpy(key, "Text Here"); //Copy "Text Here" into array
UpdateData(TRUE); //
m_strkey.Format(key[2]); //<------- Send String to Dialog Box
UpdateData(FALSE); //
}
Notice key[2] instead of just key. Not sure why it will not let me just output 1 character.
Thanks
|
|
|
|