|
Sorry, what I meant is that he even doesn't try to understand the answer. The only thing he's interested in is having the solution without too much effort. Take a lot at all his other thread (this one[^] for example).
I mean, we don't help him providing all the code for him. He needs to learn things by himself, take a good book and start from the begining.
I didn't say that to be mean but how will you learn to program when all you do is cut and paste code that people give you and then asking question why you get compile errors (without even trying to correct them yourself).
|
|
|
|
|
I take your point. The example you cited was interesting: it was based on some code I submitted but changed around a little. My point is that it looks like he's trying. I don't want to do someone’s homework (if that's what it is), but at the same time I remember what it's like to be a beginner: almost anything you read to help you soon refers to a concept you don't know or understand and it's very hard to get started.
Steve
|
|
|
|
|
makaveli_07 wrote: char str[14];
//cout << "sr"<<endl;
fin.getline(str,sizeof(str),'\n');< blockquote="">
Don't do stuff like this. Here's a rule of thumb: Forget about char arrays, use std::string s instead. i.e.
#include "stdafx.h"
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main(int argc, char* argv[])
{
ifstream ifs("C:\\a.txt");
if (ifs)
{
unsigned int line = 1;
string s;
while (getline(ifs, s))
{
cout << "Line " << line++ << ": " << s << endl;
}
}
return 0;
}
Unless you're optimising code or have some other compelling reason don't get user input in char arrays.
Steve
|
|
|
|
|
in a general manner :
for (init_statement; condition; increment_statement) {
instructions;
}
init_statement;
while (condition) {
instructions;
increment_statement;
};
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
makaveli_07 wrote: i trien in many ways but cant...
Show what you've tried and we can certainly critique.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
IS IT POSSIBLE TO HANDLE MOUSE SCROLL EVENT when the focus is on the LISTBOX.
When ListBox has only the Horizontal scrollbar,the MOUSE SCROLL Event is by default
linked to the HORZIONTAL SCROLL movement.
Is there any way to HANDLE this behaviour?
Is there any way to STOP this behaviour?
Can any one clarify?
UNABLE TO HANDLE WM_MOUSEWHEEL WHEN THE FOCUS is on the LISTBOX.
for thendral
|
|
|
|
|
Yes
use " mouse_event(MOUSEEVENTF_WHEEL,0,0,x,GetMessageExtraInfo()); "
and x is how much do you want weel to move .
also you can see mouse_event in help .
hope to be useful
|
|
|
|
|
Yes, subclass the listbox and handle the mouse messages yourself.
Steve
|
|
|
|
|
I wonder if it is possible to set breakpoint on something like kernel32!CreateFileA in WinDbg. When I try to execute this command:
bp kernel32!CreateFileA
I get this error message:
Type information missing error for CreateFileA
*************************************************************************
*** ***
*** ***
*** Your debugger is not using the correct symbols ***
*** ***
*** In order for this command to work properly, your symbol path ***
*** must point to .pdb files that have full type information. ***
*** ***
*** Certain .pdb files (such as the public OS symbols) do not ***
*** contain the required information. Contact the group that ***
*** provided you with these symbols if you need this command to ***
*** work. ***
*** ***
*** Type referenced: kernel32!CreateFileA ***
*** ***
*************************************************************************
Type conflict error at '<eol>'
Symbol server path is setup correctly and symbols are loaded.
|
|
|
|
|
You have to install the symbols which you can find in Microsoft WinDbg site.
Maxwell Chen
|
|
|
|
|
Thank you for your reply. Symbols from MS sysmbol server are installed and loaded.
|
|
|
|
|
You can download the symbol files for the OS in one hit. Another option is to select "File->Symbol File Path ..." and enter "SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols". This sets up WinDBG to use Microsoft's symbol server. Symbols that can't be found in your local symbol cache ("C:\Symbols") are downloaded from Microsoft and placed in the cache. Microsoft makes sure their symbol server is updated and it contains symbols for some of their products and not just system DLLs. Initially things may be a little slow while your symbol cache is filled (as it will be empty to begin with). Symbols are downloaded as needed and you don't have to worry about which version of Windows you're using or which Service Packs and Hotfixes have been applied.
Steve
|
|
|
|
|
Thank you for your reply. But as I said symbols are installed and loaded correctly. I can verify this by issuing lm command:
0:000> lm
start end module name
01000000 01014000 notepad (pdb symbols) C:\WINDOWS\Symbols\notepad.pdb\F679AEF8BE1F44CAB4CBC4B52D77241B1\notepad.pdb
73000000 73026000 WINSPOOL (pdb symbols) C:\WINDOWS\Symbols\winspool.pdb\97A6ECC94EA7450CA7D375BD9DFFCA5E2\winspool.pdb
763b0000 763f9000 comdlg32 (pdb symbols) C:\WINDOWS\Symbols\comdlg32.pdb\4FCBEAD63D7345998C1F92D8DBB0DC272\comdlg32.pdb
773d0000 774d2000 COMCTL32 (pdb symbols) C:\WINDOWS\Symbols\MicrosoftWindowsCommon-Controls-6.0.2600.2180-comctl32.pdb\C454919C031643618F4CAC675CBC64401\MicrosoftWindowsCommon-Controls-6.0.2600.2180-comctl32.pdb
77c10000 77c68000 msvcrt (pdb symbols) C:\WINDOWS\Symbols\msvcrt.pdb\A678F3C30DED426B839032B996987E381\msvcrt.pdb
77d40000 77dd0000 USER32 (pdb symbols) C:\WINDOWS\Symbols\user32.pdb\EE2B714D83A34C9D88027621272F83262\user32.pdb
77dd0000 77e6b000 ADVAPI32 (pdb symbols) C:\WINDOWS\Symbols\advapi32.pdb\455D6C5F184D45BBB5C5F30F829751142\advapi32.pdb
77e70000 77f01000 RPCRT4 (pdb symbols) C:\WINDOWS\Symbols\rpcrt4.pdb\BEA45A721DA141DAA3BA86B3A20311532\rpcrt4.pdb
77f10000 77f57000 GDI32 (pdb symbols) C:\WINDOWS\Symbols\gdi32.pdb\C0EA66BE00A64BD7AEF79E443A91869C2\gdi32.pdb
77f60000 77fd6000 SHLWAPI (pdb symbols) C:\WINDOWS\Symbols\shlwapi.pdb\A773F8CDBBAD4604ABA33EF708F123882\shlwapi.pdb
7c800000 7c8f4000 kernel32 (pdb symbols) C:\WINDOWS\Symbols\kernel32.pdb\FB334FB28FA34128BDE9229285BE4C2F2\kernel32.pdb
7c900000 7c9b0000 ntdll (pdb symbols) C:\WINDOWS\Symbols\ntdll.pdb\36515FB5D04345E491F672FA2E2878C02\ntdll.pdb
7c9c0000 7d1d5000 SHELL32 (pdb symbols) C:\WINDOWS\Symbols\shell32.pdb\6744E3D041704F519BD5D4D56E5388A72\shell32.pdb
These symbols are downloaded from MS symbol server (as you suggested in your post).
As you can see symbols are loaded for kernel32.dll but still WinDbg does not allow me to set breakpoints on its exports.
|
|
|
|
|
I issued the following command in WinDBG while debugging notepad:
0:000> bp user32!GetMessageW
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\WINDOWS\system32\USER32.dll -
0:000> bl
0 e 77d491c6 0001 (0001) 0:**** USER32!GetMessageW
0:000> lm
start end module name
01000000 01014000 notepad (pdb symbols) C:\Symbols\notepad.pdb\F679AEF8BE1F44CAB4CBC4B52D77241B1\notepad.pdb
5ad70000 5ada8000 UxTheme (deferred)
5cb70000 5cb96000 ShimEng (deferred)
6f880000 6fa4a000 AcGenral (deferred)
73000000 73026000 WINSPOOL (deferred)
74720000 7476b000 MSCTF (deferred)
763b0000 763f9000 comdlg32 (deferred)
769c0000 76a73000 USERENV (deferred)
76b40000 76b6d000 WINMM (deferred)
77120000 771ac000 OLEAUT32 (deferred)
773d0000 774d2000 COMCTL32 (deferred)
774e0000 7761d000 ole32 (deferred)
77be0000 77bf5000 MSACM32 (deferred)
77c00000 77c08000 VERSION (deferred)
77c10000 77c68000 msvcrt (deferred)
77d40000 77dd0000 USER32 (export symbols) C:\WINDOWS\system32\USER32.dll
77dd0000 77e6b000 ADVAPI32 (deferred)
77e70000 77f01000 RPCRT4 (deferred)
77f10000 77f57000 GDI32 (deferred)
77f60000 77fd6000 SHLWAPI (deferred)
7c800000 7c8f4000 kernel32 (pdb symbols) C:\Symbols\kernel32.pdb\FB334FB28FA34128BDE9229285BE4C2F2\kernel32.pdb
7c900000 7c9b0000 ntdll (pdb symbols) C:\Symbols\ntdll.pdb\36515FB5D04345E491F672FA2E2878C02\ntdll.pdb
7c9c0000 7d1d5000 SHELL32 (deferred)
Breakpoint 0 hit
eax=0007fefc ebx=03cc07df ecx=0000625c edx=7c90eb94 esi=00000000 edi=77d491c6
eip=77d491c6 esp=0007fedc ebp=0007ff1c iopl=0 nv up ei pl zr na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246
USER32!GetMessageW:
77d491c6 8bff mov edi,edi
0:000> k 1000
ChildEBP RetAddr
WARNING: Stack unwind information not available. Following frames may be wrong.
0007fed8 01002a1b USER32!GetMessageW
0007ff1c 01007511 notepad!WinMain+0xe5
0007ffc0 7c816d4f notepad!WinMainCRTStartup+0x174
0007fff0 00000000 kernel32!BaseProcessStart+0x23
As you can see I was able to place a breakpoint even though the symbols for user32.dll are only export symbols. Does this work for you?
Steve
|
|
|
|
|
Found source of my problem. Some time ago I set _NT_EXPR_EVAL=c++ to experiment with C++ expression evaluator and forgot to disable it after.
|
|
|
|
|
Great tip
I don't use winDbg much, how good is it, where can i find more info about winDbg?
Master.. Master.. where are the dreams that i've been after...
|
|
|
|
|
I'm not sure of any WinDBG "how to" - Probably a good idea for an article for someone. The reason I started using it is that produces good stack traces and can analyse crash dumps.
Steve
|
|
|
|
|
Hi all,
I found that there is some margin in the left side of the EditCtrl and the text inside it. It depends upon the font that set to the EditCtrl. Do anybody know how to calculate that margin?
Thank you.
- NS -
|
|
|
|
|
Use WM_NCCALCSIZE and WM_NCPAINT to trigger a WM_NCCALCSIZE .
Nibu thomas
Software Developer
|
|
|
|
|
I just want to read that margin size.
- NS -
|
|
|
|
|
Use GetWindowRect to get window dimensions
and
Use GetClientRect to get client area dimensions. The difference is the NC area or the border.
GetWindowRect returns screen coordinates. So you may have to convert any of them to either form.
Nibu thomas
Software Developer
|
|
|
|
|
I did the following.
CRect WndRect, ClientRect;
m_Edit.GetWindowRect( &WndRect );
m_Edit.GetClientRect( &ClientRect );
m_Edit.ClientToScreen( &ClientRect );
int nMargin = ClientRect.left - WndRect.left;
I got nMargin as 2. I know that is the border width. But actually there is a space Inside the client left and text. I mentioned that as the margin. I set the font as Arial 14, and from screen shot of the control I can measure this margin is about 8 pixels wide.
- NS -
|
|
|
|
|
Look up CEdit::GetMargins() and the EM_GETMARGINS message. Also CEdit::SetMargins() and EM_SETMARGINS.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Wow...! It is working fine. Thank you.
One more question,
Can I guess it without having an EditCtrl. But the font is with me.
What I need is I have to make an static text control to be same as edit ctrl.
Hope you got what I meant.
- NS -
|
|
|
|
|
NS17 wrote: What I need is I have to make an static text control to be same as edit ctrl.
Why do you want to do this? A readonly edit control should suffice!
Nibu thomas
Software Developer
|
|
|
|