|
When in trouble, read the manual. Better yet, read it before you get into trouble.
If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.
There is no need for guessing, just call GetLastError() and you will know what gives.
|
|
|
|
|
Hello,
I have a dialog box that contains an ownerdraw listbox with imaghes and text I give the option to resizes the dialog box(by SetWindowPos),
such that not all of the listbox is appear ,
I changhed the vertical and the horizontal scrollbar properties to be true and they are appearing on dialog but I can't scroll them although the list box is not appear completely,
how can I cause the scroll bar to work appropriate ?
thanks
|
|
|
|
|
I just had what might be a similar problem, though it was just the horizontal scrollbar giving me trouble. I had to call SetHorizontalExtent, giving it the widest thing in the list in pixels.
Try calling that and see if it helps at least with the horizontal scrollbar.
|
|
|
|
|
Hi all,
please could i get some help on how to restrict writing to USB.
This is a complicated requirement i have, however this is what i need to achieve.
i need to restrict writing to USB. however writing can be done specifically to a folder and that too a specific file type.
i can use registry to block writing to USB, however this does not suit to the requirement.
hence i need some help on how to block writing to USB and allow only specific files to be written to one specific folder.
ThankYou.
|
|
|
|
|
You would need to write a USB filter driver which is not an easy task to do.
|
|
|
|
|
Hi all,
In my application i m insert the value from browsed list,
here i create a function to check same value in list,
if same value is found its generate new value for it
for example "abc",if again found "abc" its generate "abc1","abc2".. so on.
when i debug the code its working fine.
but when i run the application without debugging the code function not working fine.
its not generate new value and insert same value in list.
please help me for this.
thanks in advance.
|
|
|
|
|
Try posting some of the code of your program (remember to put it within <pre></pre> tags) so we can see how you are doing it.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
|
Hi all,
I have made a worker thread. I want to pass a integer as a parameter in my thread.
I am not getting how to do it.
Can anybody help me this.
Thanks in advance
|
|
|
|
|
A thread accepts a void pointer as its parameter.
If you want to pass an integer, you first typecast it as a void pointer and then typecast it back to an integer inside the thread function.
|
|
|
|
|
can you please explain me using a example.
|
|
|
|
|
Thread creation may look like this -
CreateThread(0, 0, Start, (LPVOID)1024, 0, 0);
Here 1024 is the value passed as parameter.
The thread function may look like this-
DWORD WINAPI Start(LPVOID p)
{
int i = (int)p;
return 0;
}
Here the passed in parameter will be available in the variable i.
|
|
|
|
|
Why don't you post the code you have written for your thread so that we can help you better?
|
|
|
|
|
It's been quite some time since I last used VC6 but I am currently working on an older project. I am sure there used to be a disable all breakpoints option but I cannot find it. It's not in the debug menu or the debug toolbar which is where I am sure it used to be. Anyone know where it is?
|
|
|
|
|
Tools > Customize > Commands tab. Choose Debug from the drop down box. On the right pane select the icon with two hands.
|
|
|
|
|
|
Alternatively, Alt+F9 to remove all breakpoints.
|
|
|
|
|
In that case better use Alt+F9 and Alt+L in sequence and then return key. You don't need mouse to write code
|
|
|
|
|
Doesn't work in the Swedish or German version... otherwise totally agree.
|
|
|
|
|
WOW! that's news to me. Why so, is it a bug or does 'L' map to something else?!
PS: Searching the web was a chore so I am asking you.
|
|
|
|
|
Alt+L works because of the button text in the English dialog window (underlined letter L), right? My first guess is that it's not a keyboard accelerator and depends on internationalisation (different button text often means different key combination to activate that button).
|
|
|
|
|
Hi all..
i had made a exe with all shortcuts to system accessories and also editboxes to keep note of all priority things. It also displays the time elapsed from the system turn on time. If I check the Memory usage for this exe its drastically increasing.. Iam displaying the Hour:Minute:Second.. For each updation of these its consuming lot of memory. Plz help me to solve this.. I use this exe as part of my day to day work.
Thanks in advance.
|
|
|
|
|
You probably have some memory leak. Make sure that each memory allocated with new is deallocated with delete. Make also sure that you release all resources loaded on the update.
It's a bit difficult to give more detailed information since you didn't provide any code.
|
|
|
|
|
The first thing to do is look for everywhere you use "new." Wherever you find these places see if you can change the object to an automatic/stack based object OR immediately assign the result of the new to a management object (something like std::shared_ptr or boost::shared_ptr).
If that doesn't work have a look at libraries you're using and understand how objects in that library work. So if you're using MFC understand why and how CWnd objects handle self deletion in PostNCDestroy. If you're using OpenSSL make sure (by automating it) that all your BIO objects are closed properly. And so on with other libraries...
The point here is that if you don't do any manual memory management you can't leak any memory. Manual memory management can take many forms (e.g. using a vector as a stack and not clearing popped entries) so it's not necessarily just looking for "new" but it's a good start.
Cheers,
Ash
PS: Just thought - if you're using lower level raw memory management stuff like malloc/free( from the C standard library), HeapAlloc/HeapFree (from the windows API) or even VirtualAlloc(also from the windows API) make sure you're balancing allocations with freeing using management objects.
So my zeroth bit of advice should have been "don't use any object management apart from new/delete in C++ unless you have a very good reason not to." Once you've done that you can start removing news from your code.
modified on Thursday, October 7, 2010 7:22 AM
|
|
|
|
|
hii.. thanks a lot for that immediate response...
iam sharing few lines of code related to Editbox and Timer.. "New" is used in my code in OnCtlColor()..
please have a look in those.. If u are able to figure out with this ,where the problem is, plz do tell me...
BOOL CNoteDlg::OnInitDialog()
{
SetTimer(ID_CLOCK_TIMER,1000,NULL);
m_edit1.SetLimitText(10000);
m_edit1.SetWindowText("");
}
HBRUSH CNoteDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
if(pWnd->GetDlgCtrlID() == IDC_EDIT1)
{
pDC->SetTextColor(RGB(255, 0, 0));
pDC->SetBkColor(RGB(255, 255, 255));
brush = new CBrush(RGB(255,255,255));
}
}
void CNoteDlg::OnTimer(UINT nIDEvent)
{
DWORD totalseconds = 0, dwSec = 0, dwMin = 0;
if(GetUpTime(totalseconds))
{
dwSec = totalseconds % 60;
dwMin = totalseconds / 60;
}
DisplayUpTime(dwMin, dwSec);
}
void CNoteDlg::DisplayUpTime(const DWORD& dwMin,const DWORD& dwSec)
{
m_sbegin.Format("%d hours : %d minutes : %d seconds",(dwMin/60)%24, dwMin%60,dwSec);
GetDlgItem(IDC_BEGIN)->SetWindowText(m_sbegin);
}
Thanks again...
|
|
|
|