|
what do you mean ?
How do i do what ?
I just sending the message after update the variable through the registry.
|
|
|
|
|
Yanshof wrote: what do you mean ?
How do i do what ?
I was inquiring about your "i update those Environment variables" comment.
Yanshof wrote: ...update the variable through the registry.
This answers my question.
Why is SendMessageTimeout() not working for you?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
My project have a list control and have to add a lot of data to it(more than 1000 item) I use these code for add each item.
void CGraphFrom::AddDataList(CListCtrl *m_list, int row,<br />
CString col0, CString col1, CString col2, <br />
CString col3, CString col4, CString col5)<br />
{<br />
<br />
LVITEM lvi;<br />
lvi.mask = LVIF_TEXT;lvi.iItem=row;<br />
lvi.iSubItem = 0;lvi.pszText = (char*)(LPCTSTR)col0;<br />
m_list->InsertItem(&lvi);<br />
<br />
lvi.iSubItem = 1;lvi.pszText = (char*)(LPCTSTR)col1;<br />
m_list->SetItem(&lvi);<br />
<br />
lvi.iSubItem = 2;lvi.pszText = (char*)(LPCTSTR)col2;<br />
m_list->SetItem(&lvi);<br />
<br />
lvi.iSubItem = 3;lvi.pszText = (char*)(LPCTSTR)col3;<br />
m_list->SetItem(&lvi);<br />
<br />
lvi.iSubItem = 4;lvi.pszText = (char*)(LPCTSTR)col4;<br />
m_list->SetItem(&lvi);<br />
<br />
lvi.iSubItem = 5;lvi.pszText = (char*)(LPCTSTR)col5;<br />
m_list->SetItem(&lvi);<br />
<br />
}<br />
my problem is that
while program is adding the item my program look like hang up,
because the list control is updated every time when it add item.
How can I do if I want to update it only one time when it finish adding item.
|
|
|
|
|
This does not solve your "hang up" problem, but depending on how the control is sorting the items, there is the potential for the SetItem() calls to not match the InsertItem() call. Try this instead:
void CGraphFrom::AddDataList(CListCtrl *m_list, int row,
CString col0, CString col1, CString col2,
CString col3, CString col4, CString col5)
{
int nItem = m_list->InsertItem(row, col0);
m_list->SetItemText(nItem, 1, col1);
m_list->SetItemText(nItem, 2, col2);
m_list->SetItemText(nItem, 3, col3);
m_list->SetItemText(nItem, 4, col4);
m_list->SetItemText(nItem, 5, col5);
} Adding 1,000 items is trivial, but if it is causing the UI to become unresponsive, your only recourse is to do the updating in a secondary thread.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I had similar issue with editing in edit control.
It went away by using ShowWindow(SW_HIDE) before and ShowWindow(SW_SHOW) after the edit/ search / update.
Try that, it may help, but I feel that the "insert" item is the real isssue here.
|
|
|
|
|
first of all... not coding in OnDraw ();
code it in a separated function and in the OnDraw () do an evaluation of a flag. Something like:
if (bListRedraw)
UpdateListCtrl ();
in this UpdateListCtrl () funciont, the last line have to reset the flag (bListRedraw = FALSE).
in your methode of adding item, the last line have to set the flag (bListRedraw = TRUE).
I have sent you an email with some code that I used in one app. It deals with creation, initialitation and update of ListCtrl in a quite complex structure of Objcet derived elements and their datas.
Take a look, try to modify your code and ask if you dont understand something.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
I am dynamically loading a second process (via CreateProcess) and would like to automatically set breakpoints in that process. VS2005 doesn't automatically set the breakpoints even though the code I want to break on exists in both projects.
Is there an API I can call to set a breakpoint on a function in another process?
|
|
|
|
|
After it is started via the CreateProcess, fire up another instance of VS2005 and "attach" to the just launched process. You can set breakpoints now. If you need to debug the process's startup code, use DebugBreak and connect VS2005. I've always used a new instance of VS to debug each different process - don't know if you can do multiple processes all in one.
Judy
|
|
|
|
|
Ah, but that's the problem. By the time I can click on Attach To Process and then select the process and press Attach, the program I'm trying to trap has already run the function I want to trap.
I can't modify the source to the program I want to attach to.
I need to find a way to set breakpoints in the launched process via the application I am writing. Something like:
{
CreateProcess("newprogram.exe", ... CREATE_SUSPENDED, ... );
SetBreakpoint(newProcessHandle, "FunctionToDebug");
ResumeProcess(newProcessHandle);
}
|
|
|
|
|
Soundman32.2 wrote: By the time I can click on Attach To Process and then select the process and press Attach, the program I'm trying to trap has already run the function I want to trap.
In your processes code, call DebugBreak(), and the code execution will stop and you will be given the chance to attach a debugger.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
That's a tough one without being able to modify the source of the target. Just to make sure you haven't missed the obvious, have you tried to Attach after the process is created in the suspended state? I don't expect it to work, but I personally don't know what else to try. You're down to the point of having to do something to modify the target. If you can't touch the source, the only thing left is modifying the asm code in the .exe file. Can't help there.
Sorry,
Judy
|
|
|
|
|
Hi Experts,
Plz tell me how to check the registry for a prticular version of MS-Outlook?
and how to make changes in Registry.
|
|
|
|
|
Look at the HKLM\SOFTWARE\Microsoft\Office key.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
It's getting embarrassing watching you utilize documentation so frequently
|
|
|
|
|
following code is correct.
class MyInt
{
public:
int i0;
int i1;
int i2;
};
<br>
<br>
MyInt myData[]=
{
{1, 0, 2},
{5,},
{4,},
};
I hope default value of i1=100 and i2=200;
So I add construct to class MyInt:
class MyInt
{
public:
MyInt()
{
i1=100;
i2=200;
}
int i0;
int i1;
int i2;
};
<br>
<br>
MyInt myData[]=
{
{1, 0, 2},
{5,},
{4,},
};
This time, I got a compile error:
error C2440: 'initializing' : cannot convert from 'const int' to 'class MyInt'
which points to //error line.
The error looks like syntax error, how to solve the problem and set i1 and i2 to default values?
|
|
|
|
|
Strange, I'm not finding errors
have you tryed this constructor way?
MyInt()
: i1(100)
, i2(200)
, i3(0)
{
}
-- modified at 9:51 Monday 10th September, 2007
At the same time I'm not so sure that you can define a constructor and initialize the elements of the class as it is a struct. This sintax is forcing a little the flexibility of the C++ language. I mean that this time probally it is better if you spend some time writing ALL the initialization by hand.
Russell
|
|
|
|
|
You can't use the array initializer syntax on a struct that has a ctor. Do this instead:
MyInt myData[]=
{
MyInt(1,0,2),
MyInt(5),
MyInt(4)
}; And what's with all those extra commas?
|
|
|
|
|
Hello friends,
I am working on a project in which It is sending the packet on the Internet server at the interval of 3 sec. The packet is roughly of 1KB(kilo Bytes) size. And when I check the programme in the Taskbar it show the CPU Usage to 50%.
The project is a simple Dialog based WIN32 application. And it uses SOCKET and Timer to send and receive the data from Internet Server.
Is there any way I can reduce the memory usage.
Or please tell me what are the possible flaws that can lead to this type of proble.
|
|
|
|
|
Hi,
when you poll for new data, you have seriously a loop (while(!Stop) or something like this)
you should use a Sleep(10) or Sleep(100) into this loop, otherwise this thread is working nonstop.
Good luck
|
|
|
|
|
Thanx,
NOW I am using the Sleep(); in my function. and all working fine.
|
|
|
|
|
If the absence of Sleep() causes your program to not work, that usually indicates a design flaw.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Whatever works for you, I guess, but most would say that's a really bad design.
You're wasting CPU resources in a loop for something that can be made completely event
driven and work VERY efficiently.
By the way, if you're using a SOCKET and a timer, how is it possible that you're using any
noticeable CPU?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I've learned much from this article. But now I got some problem.
How to get client's IP address when it act as a server?
Thanks in advance.
----------
C++ Learner
|
|
|
|
|
Hi,
i made it this way :
SOCKADDR_IN ClientAddress;
int adrlen = sizeof(ClientAddress);
accept(ListenSocket,(LPSOCKADDR)&ClientAddress,&adrlen);
then you get the String of the Client's IP Adresse this way:
inet_ntoa(ClientAddress.sin_addr)
I hope this helps you
|
|
|
|
|
Thanks for your assistance.
I added those lines to my project.
But, when I build the project, there was an error :
error C2065: 'ListenSocket' : undeclared identifier
So I added this line :
SOCKET ListenSocket;
Then I build it again, although I got some warning :
warning C4700: uninitialized local variable 'ListenSocket' used
there was no error.
Then I debug, try to connect from other computer.
It was connected, could read the buffer, but my program shows "0.0.0.0" as client's IP address.
Any suggestion?
----------
C++ Learner
|
|
|
|