|
Does your queue need to be a fixed size ? The other way to do it is a linked list, which is where you create a series of items that each contain the data you want, and a pointer to the next item, and possibly the previous also.
ian_ok wrote:
delete input; // Clean up
This does not work. To delete an array you need to do this:
delete [] input;
ian_ok wrote:
first=Array_Size;
last=0;
What are these for ? If you have an array, you can keep an index of how many items you have, and access items using either array notation ( input[pos] ), or pointer arithmetic ( *(input+pos) ).
I see you're using array notation.
ian_ok wrote:
first %= Array_Size; // Wrap the queue
return input[first++]; // Remove
I don't get this - how does this remove items from the queue ? That is, how does it reclaim the memory and make room in the queue ? If you want to use an array as your storage, you should use memcpy to move all the existing values down so there is room created at the end.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Hi everyone!
I need to resize all the controls in a CFormView class on WM_SIZE message.
I tried to resize each control seperately but it didn't worked.
Also tried the code from OnInitialUpdate():
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
but it does not resizes the controls...
Any solutions of the problem?
Thanks in advance!
Gogou
|
|
|
|
|
Gogou wrote:
I tried to resize each control seperately but it didn't worked.
What happened ?
the WM_SIZE callback is the place to do it, maybe you get the wrong RECT ? in the handler, you get the client rect ( GetClientRect ), this will give you the client rect of the formview, once that's done, you MoveWindow each of the controls you want to move.
Max.
|
|
|
|
|
Any easy and quick way to write some bytes to the parallel port on windows 2000.
Should be an easy one....
Thanks in advance.
Shay Harel
|
|
|
|
|
hi everyone,
how do you create a right mouse click popup menu like ones that are use in most of the application, e.g. windows explorer, ie6..etc..
also, how do you disable a menu item in a menu(i.e. gray out the command in a menu)?
thx in advance.
|
|
|
|
|
There are several solution. One solution for a popup menu is a context menu. Search context menu in help or MSDN.
I do not have access to my source code right now. I can give you an example of a context menu tonight when I have access to my workstation.
Kuphryn
|
|
|
|
|
Lookup TrackPopupMenu on MSDN.
Jason Henderson start page ; articles
henderson is coming
henderson is an opponent's worst nightmare
* googlism *
|
|
|
|
|
Try this:
CPoint p;
GetCursorPos(&p);
CMenu menu;
menu.LoadMenu(IDR_MY_MENU)
CMenu* pPopup = menu.GetSubMenu(0);
ASSERT(pPopup != NULL);
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, p.x, p.y, AfxGetMainWnd());
note: the commands will be routed to the main window. To rout the commands to another place, replace AfxGetMainWnd() with a CWnd* of the window you want to get the messages.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
With Visual C++ Version 6.0 I face a problem that the next property page is not completely drawn after the message box has been closed. In the OnWizardNext() function I check the input fields and if an input is not acceptable I invoke an AfxMessageBox() function with Yes No button to continue or not. If the return value is IDNO I set the return value of the OnWizardNext() funtion to -1, so there is no jump to the next page. If the return from the message box is IDYES I set the return value to the default OnWizardNext() reurn wich is 0. Then a jump to the next page is performed but the next page is only partly drawn. The drawn area corresponds a pproximately with the rectangle including the controls in previous page.
Can some body give me indications how I can solve this problem ?
|
|
|
|
|
I have a CListCtrl embedded in a CFormView. Basically all I'm trying to do is make it so that long strings to not get cut off with a "..." at the end. In other words "The quick brown fox jumped over the lazy dog" will appear as "The quick brown fox jumped over ..." Pain in the butt it seems. Anyway if anyone has a solution to this problem, please respond. Thanks.
Mike
|
|
|
|
|
seems you are not familiar with the member functions.
See SetColomnWidth() member func
Hari
Hari Krishnan
|
|
|
|
|
If two applications running on one PC use the following bind call, what will happen?
sock.sin_family = PF_INET;<br />
sock.sin_addr.s_addr = htonl(INADDR_ANY);<br />
sock.sin_port = htons((u_short)0);<br />
<br />
if (bind(*lpSock,(LPSOCKADDR)&sock,sizeof(sock)) != SOCKET_ERROR)<br />
nRet = ENOERROR;
When a UDP message comes in with the dest. port of 2000 (for example), which application will get it (or will both)? I'm guessing that it cannot be determined/random? I really don't have any idea.
I realize this is a fairly basic sockets question but I have not been able to find any information on how this situation would behave.
Thanks for any info. you may have.
|
|
|
|
|
I think that no more than one application can bind to a given port at the same time.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Thanks,
since the port number is 0 here, doesn't that mean that it will attempt recv. from all port numbers?
|
|
|
|
|
Dave_ wrote:
since the port number is 0 here, doesn't that mean that it will attempt recv. from all port numbers?
Hm... have you tried using port 0?
You can't bind to port 0!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Yes, I have tried - we have software that has been running for years this way. The problem came up when another application sent/rcvd UDP messages at the same time. I'm guessing that they are using the bind with port 0 also (for the rcv socket), and they are getting some of the UDP messages that were meant for us.
|
|
|
|
|
Aah.. but then it must be specific for the UDP protocol to bind on port 0!
I don't know UDP that much.
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Thanks anyway. Maybe I will post another message with UDP and port 0 in the heading. This is very difficult to find any information on since 90% of programmers are using TCP instead.
|
|
|
|
|
Dave_ wrote:
Maybe I will post another message with UDP and port 0 in the heading
Don't do that!
It's a bad thing to re-post a message, if you have bad luck someone will give you a lesson...
But click the "Modify" link in your message and change the subject!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
as far as I know, trying to bind to port 0 using UDP will just make it pick its own port that isn't already allocated. You can't have 2 programs running using the same port.
http://www.ecst.csuchico.edu/~beej/guide/net/html/syscalls.html
Its for linux but its the same case as far as I've tested (lots in the last month) as winsock. I've just finished a biggie UDP based program and wouldn't let it try to bind to port 0 if my life depended on it, I'd rather know where it was going thanks
|
|
|
|
|
I need some help. I need source code that will recursively search the registry and delete text found. It would need to work on 95/98/NT/XP/2000. I'm looking to return a list (perhaps in a list box) of all keys (ALL TEXT) that were found. If that Text appears anywhere in registry I want it added to my list. Then I can select/deselect what I wish and then delete the selected items. Allow someone to highlight and delete specific ones.
Any ideas?
Any help is appreciated.
Cheers,
Derek
|
|
|
|
|
try this:
HKEY hKey = NULL;
CString csCadenaA[10];
CString csCadenaB[10];
csCadenaA[0] = "Software\\akuna\\matata\\";
csCadenaB[0] = "LionKing";
csCadenaA[1] = "Software\\lilo\\stitch\\";
csCadenaB[1] = "ls";
for (int i=0;i<10;i++)
{
RegOpenKeyEx(HKEY_LOCAL_MACHINE,csCadenaA[i],0,KEY_ALL_ACCESS,&hKey);
if (hKey != NULL)
{
RegDeleteKey(hKey, csCadenaB[i]);
}
}
OK, the strings used in this sample are stupid, but it works...
Hope this helps...
|
|
|
|
|
How do I specify an Icon and a default File Extension to my MDI document ?
Please help
|
|
|
|
|
You can specify an extension in the wizard when you create your MDI project.
The Icon can you just replace, that one you have as standard can you find in the res directory I think. Just replace the icon and TADA!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Once I have created a project how do I specify the extension ?
|
|
|
|