|
Anonymous wrote:
You see that he is able to delete and add to the list simultaneously.
Ok, but what does that have to do with other threads updating the UI? The only thread that should be accessing the list control is its owner. All other threads, whether they are adding or deleting, should be posting a message.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Each thread should post a message, indicating what item to delete, back to the primary thread that owns the list control. Any other way is not guaranteed to work.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I have previously installed the platform sdk to a pretty dumb path.
I have cancelled the action.. but there were still some files in the directories. Tried to deinstall the platform sdk -> and then make a clean install:
pretty dumb, because it doesn't let you choose the path when installing the 2nd time.
So i tried to delete all the registry keys -> but it doesn't let you choose the path when installing the 3rd time.
Any ideas ?
"Just looking for loopholes." W. C. Fields American actor, 1880-1946, explaining why he was reading the Bible on his deathbed.
|
|
|
|
|
If you didn't successfully uninstall the platform SDK then I suggest this.
1) Install the SDK fully over the top to the directory it insists to install to.
2) Uninstall the SDK, this should now succeed.
3) Install the SDK to the directory that you want.
Hope this helps
Ant.
|
|
|
|
|
If I try to use pipe to run coomands through command.com, the program does not return even after the command.com has finished writing to the pipe. The ReadFile() function simply waits there for input on windows 98. This code is running fine on windows 2000. Does Anybody have any solution?
The part of code where the execution stops responding is:
while(1) {
succ = ReadFile(hReadPipe, buffer, sizeof(buffer)-sizeof(char), &nread, NULL);
//****** it waits here after reading all the op from the pipe***********//
if(nread == 0)
break;
buffer[nread]=0;
fwrite(buffer, strlen(buffer), 1, fp);
}
if(nread) {
buffer[nread]=0;
fwrite(buffer, strlen(buffer), 1, fp);
}
fclose(fp);
DWORD err = ::GetLastError();
::CloseHandle(hReadPipe);
Can anyone help ???
|
|
|
|
|
Have a look at this[^]. You need to use duplicate handle and close your end of the pipe, otherwise your child process will hang.
Ryan
|
|
|
|
|
Hi
Anyone Know how to change the border style of a listbox at runtime...That means when listbox is non-active, the border is not bold but it is in focus, the border is darker to indicate to the user...
I tried to use getwindowlong and setwindowlong but i am unable to set it properly..maybe i miss some APIs..
Thanx.
|
|
|
|
|
Like:
GetDlgItem(IDC_LIST1)->ModifyStyle(0, WS_THICKFRAME, SWP_DRAWFRAME);
If you say wanted to turn on WS_THICKFRAME at runtime.
Or
GetDlgItem(IDC_LIST1)->ModifyStyle(WS_THICKFRAME, 0, SWP_DRAWFRAME);
To remove
|
|
|
|
|
Hi all
I get a some complcation here:
template <class t=""> void fun(..)
{
...
switch (typeid(T))
{
case (typeid(char)):
....
break;
}
...
}
/*
This snip of code brought a compiler erro
1) typeid(T) - return const type_info& value and
this inconsistent with switch(...) - expression type
2) case(...) - expression in brackets should be const but in this case
its const referience[const type_info&]
I cant do an casting here because of type_info constructor
private.
*/
...
}
Can i avoid this error ,or i had to use if() statement,in this case.
THANKS
|
|
|
|
|
You can only switch on integral types - char , short , int , long (and their unsigned variants) and enumerated types.
You'll have to use an if statement in this case.
If you have to modify your processing based on the template parameter, then I don't thing you're really understanding the concepts of using templates. Read some articles or books on templates, particularly on partial template specialisation. "Modern C++ Design" by Andrei Alexandrescu is an extremely good book for learning about templates in depth.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
HI all
the setup i'm working on has the debugger out of step with the code.
Working in Visual C++.net.
If i set a breakpoint and step through the debugger thinks theres code where there is clearly whitespace.
I've cleaned and rebooted and rebuilt and all that but it doesn't seem to help.
There is only one copy of the source code on the hard drive and the build times are correct for all the files
I was wondering if anyone had any suggestions as to what might be going on and any solutions that might present itself.
regards
Bryce
---
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
|
|
|
|
|
Are you debuging a DLL? I have only come across this when the DLL I was debugging was not current!?
Ant.
|
|
|
|
|
Hi
Had this problem several times and got rid of it by cleaning the project first in Visual Studio and then going to the folder and deleting manually all remaining files generated by Visual Studio.
Cheers
Peer
|
|
|
|
|
which files specifically did you delete?
obviously i need to keep the .vcproj file...what else?
regards
Bryce
---
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
|
|
|
|
|
turns out some plonker had been opening the files ona unix box
guess what that did to the linefeeds etc
Bryce
---
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
|
|
|
|
|
i am trying to enumerate the whole network using RESOURCE_GLOBALNET arguement in the WNetOpenEnum(.,.,.,.,.) function. Program is not running properly it just gives me name of the first domain it finds and then the it terminates. When i use the RESOURCE_CONTEXT arguement in the WNetOpenEnum(.,.,.,.,.) i am able to get all the machines of the particluar sub domain, in which the application is running. For test purposes i am using the following code can any one point out the problem in this code
#include <iostream.h>
#include<windows.h>
#pragma message("network library is linking with \"mpr.lib\"")
#pragma comment(lib, "mpr.lib")
BOOL GetResources(NETRESOURCE *);
int main()
{
cout<<"hello"<<endl;
="" getresources(null);
="" return="" 0;
}
bool="" getresources(netresource="" *pnetresource)
{
="" dword="" dwscope="RESOURCE_GLOBALNET;
" netresource="" *netresource="NULL;
" handle="" henum;
="" wnetopenenum(dwscope,="" null,="" null="" ,="" pnetresource,="" &henum);
="" if="" (henum)
="" {
="" count="0xFFFFFFFF;
" buffersize="2048;
" lpvoid="" buffer="new" char[2048];
="" wnetenumresource(henum,="" &count,="" buffer,="" &buffersize);
="" netresource,="" for="" (uint="" i="0;" <="" sizeof(netresource);="" i++,="" netresource++)
="" (netresource-="">dwUsage == RESOURCEUSAGE_CONTAINER && NetResource->dwType == RESOURCETYPE_ANY)
{
if (NetResource->lpRemoteName)
{
if(NetResource->dwDisplayType == RESOURCEDISPLAYTYPE_DOMAIN)
{
cout<<endl<<"domain "<<="" netresource-="">lpRemoteName;
GetResources(NetResource);
continue;
}
cout<<endl<<"machine "<<netresource-="">lpRemoteName;
GetResources(NetResource);
continue;
}
}
GetResources(NetResource);
}
}
return true;
}
|
|
|
|
|
I massaged your code a little:
bool GetResources( NETRESOURCE *pNetResource )
{
DWORD dwResult;
NETRESOURCE *NetResource = NULL;
HANDLE hEnum;
dwResult = WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_ANY, 0, pNetResource, &hEnum);
if (NO_ERROR == dwResult)
{
NETRESOURCE Buffer[750];
DWORD Count = 0xFFFFFFFF,
BufferSize;
BufferSize = sizeof(Buffer);
do
{
dwResult = WNetEnumResource(hEnum, &Count, &Buffer, &BufferSize);
if (NO_ERROR == dwResult || ERROR_MORE_DATA == dwResult)
{
for (UINT i = 0; i < Count; i++)
{
if ((Buffer[i].dwUsage & RESOURCEDISPLAYTYPE_DOMAIN) == RESOURCEDISPLAYTYPE_DOMAIN)
cout << "Domain " << Buffer[i].lpRemoteName << endl;
else if ((Buffer[i].dwUsage & RESOURCEDISPLAYTYPE_SERVER) == RESOURCEDISPLAYTYPE_SERVER)
cout << "Server " << Buffer[i].lpRemoteName << endl;
else
cout << "Machine " << Buffer[i].lpRemoteName << endl;
if ((Buffer[i].dwUsage & RESOURCEUSAGE_CONTAINER) == RESOURCEUSAGE_CONTAINER)
GetResources(&Buffer[i]);
}
}
} while (NO_ERROR == dwResult || ERROR_MORE_DATA == dwResult);
dwResult = WNetCloseEnum(hEnum);
}
return true;
}
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
thanks David i am able to traverse the whole network quite successfully, but there is slight problem its showing no machines rather its showing machines as servers. So where would i have to make changes to make this code perfect..
|
|
|
|
|
The dwUsage member is going to have one of the following values:
RESOURCEDISPLAYTYPE_GENERIC
RESOURCEDISPLAYTYPE_DOMAIN
RESOURCEDISPLAYTYPE_SERVER
RESOURCEDISPLAYTYPE_SHARE
RESOURCEDISPLAYTYPE_FILE
RESOURCEDISPLAYTYPE_GROUP
RESOURCEDISPLAYTYPE_NETWORK
RESOURCEDISPLAYTYPE_ROOT
RESOURCEDISPLAYTYPE_SHAREADMIN
RESOURCEDISPLAYTYPE_DIRECTORY
RESOURCEDISPLAYTYPE_TREE
RESOURCEDISPLAYTYPE_NDSCONTAINER It's up to you to decide what a "machine" is.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanx David for your help
|
|
|
|
|
Hi,
I have a toolbar which has a variable amount of buttons. (the amount of buttons is determined at run time)
To send a message and to perform a function, OK, but then I have 1 function for more then 1 button, how can I let this function know which button is pressed?
tnx a lot for your help!
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimmy Hendrix
|
|
|
|
|
You might want to check ON_COMMAND_RANGE for this.
|
|
|
|
|
Hi folks,
I have the problem, that I want sent a bill as Email from a C++ Application over Outlook. So I want set the Email to plain text or alternative to set the font to Courier etc.
This is my Eample:
void CMyClass::SendEmail()
{
CString sStr, sMsg, sSubject;
_Application olApp;
COleException e;
double price1 = 100000;
double price2 = 20000;
if(!olApp.CreateDispatch("Outlook.Application", &e)) {
CString str;
str.Format("CreateDispatch() failed w/error 0x%08lx", e.m_sc);
AfxMessageBox(str, MB_SETFOREGROUND);
return;
}
_NameSpace olNs(olApp.GetNamespace("MAPI"));
COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
olNs.Logon(covOptional, covOptional, covOptional, covOptional);
_MailItem olMail(olApp.CreateItem(0));
olMail.SetTo("test@domain.com");
olMail.SetSubject("My bill");
sStr.Format("Item1:%#30.02", price1);
sMsg += sStr;
sStr.Format("Item2:%#31.02", price2);
sMsg += sStr;
olMail.SetBody(sMsg);
olMail.Display(covOptional);
olNs.Logoff();
}
Who can help ?
|
|
|
|
|
Hi there,
When the user clicks on the Close or X button of a FormView, I would like a dialog box to appear asking if the user would like to save the changes. What function does the X button call when you close it so that I can write a function to override it? I realized that if I have a close button in my form, I can simply call PostMessage(WM_COMMAND, ID_FILE_CLOSE) to close it. But what if I do not want to just close the window but instead have it to do the same thing described above. How can I accomplish this?
Any help would be much appreciated! Thanks!
|
|
|
|
|
Try WM_SYSCOMMAND with nID parameter SC_CLOSE
When the user clicks on the Close or X button of a FormView, I would like a dialog box to appear asking if the user would like to save the changes
>
SetModifiedFlag(TRUE); //Of CDocument class
will do this for you.
|
|
|
|