|
and how to use them, show me an example, plz.
Extreme programming. Do the No.1
|
|
|
|
|
Look the code, it doesn't work
<br />
int CALLBACK MonitorCallback(HGLOBAL hBuf, int nLen, LPARAM lParam)<br />
{<br />
LPBYTE lpBuf = (LPBYTE)::GlobalLock((HGLOBAL)hBuf);<br />
if(!lpBuf)<br />
return 1;<br />
<br />
CString str=HexDump(lpBuf,nLen);<br />
CEdit Edit;<br />
<br />
Edit.Attach((HWND)lParam);<br />
CEdit *pEdit=(CEdit*)Edit.FromHandle((HWND)lParam);<br />
pEdit->SetWindowText(str);<br />
<br />
return 0;<br />
<br />
}
what's wrong???
Thanks in advance
Extreme programming. Do the No.1
|
|
|
|
|
|
CWnd* pEdit = CWnd::FromHandle ( (HWND) lParam );
pEdit->SetWindowText ( str ); Although you don't need to muck about with CWnd s for such a simple task. Using the APIs would be simpler:
SetWindowText ( (HWND) lParam, str );
--Mike--
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
This time I use a CListCtrl to accept data, this ListCtrl has three Columns for "No.", "Value" and "Time". its works well in my dialog, but after use Callback function to transfer ListCtrl Hanlde, the 2 subItems can't accept data, why?
Extreme programming. Do the No.1
|
|
|
|
|
Hello All,
Is there anymore than this that I need to do so that the font used to print on a CStatic control is changed?
CFont font;
font.CreatePointFont (80, _T("Times New Roman"));
CWnd* pPrices = GetDlgItem (STATIC_SHOW_ALL);
pPrices->SetFont (&font, TRUE); STATIC_SHOW_ALL is the ID of my static control. When I write on the control now (using a member var that's attached to it) it changes the font from the default the dialog is using but not to the font I set it to. Any help is as always much appreciated.
- monrobot13
|
|
|
|
|
|
Works like a dream now. Thanks much.
- monrobot13
|
|
|
|
|
When i priting,I always get a left and top margin,like printing a pixel on the left top corner:pDC->Pixel(0,0,RGB(0,0,0))
the result on the paper always get an offset.
I can get the physical offset of the printer,but how to change the offset,I tried SetViewportOrg,nothing changed!
any help?
int x = pDC->GetDeviceCaps(PHYSICALOFFSETX);
int y = pDC->GetDeviceCaps( PHYSICALOFFSETY);
pDC->SetViewportOrg (-x,-y);
|
|
|
|
|
Most ink jet and laser printers can not print from edge to edge of the paper. They can usually print to within 0.25 inches of the edge. The limit may be less, depending upon which edge and the type of printer.
Gary R. Wheeler
|
|
|
|
|
2 part question. How do you include a dll in an app that I can call from a seperate exe. Like the way you call the excel.exe file but it is used as a dll. Thanks for your help.
Darroll
Not one person lives in the present. Only the past. I can prove it.
|
|
|
|
|
Hi,
where can i find the information on Design pattern ?
thanks
Extreme programming. Do the No.1
|
|
|
|
|
In any books you might find on www.amazon.com that have the words 'design pattern' in them. I don't know of any websites really. safari.oreilly.com has some, and a 14 day free trial.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Microsoft Press has a book on Design Pattern of Visual Basic programming call Microsoft Visual Basic Design Patterns. I remember they also have one for software developement, but I can't remember the name of it.
If you want a very high level overview of the software life cycle, many university uses R S Pressman, Software Engineering: A Practioner's Approach, 5th edition, McGraw-Hill, 2000 It's a pretty good book, but it won't tell you in technical details what is good code pratice and what is not. If you find a good book with good code examples in a large enough project, let me know!
http://LessExpense.tripod.com
|
|
|
|
|
Ward Cunningham's WIKI site at : http://www.wiki.org[^]
has design pattern info. Or you could invest in the book written by the 'Gang of Four', Eric Gamma et al, mentioned somewhere within the Wiki - do a wiki search and you should find more details
Cheers, Garth
|
|
|
|
|
Hello,
I'm writing a program that displays a list of tasks on a CListView report. The report view will have varying text color/font & item background colors depending on the context of each specific task (list item).
Where should I put the functions to determine these GUI parameters? In the document class or the CListView derived class? Should the document have functions that return the color of each specific list item? Or should the ListView make the determination based on gathering information about the Document tasks/items?
I suppose I could throw out the idea of modularity and just treat the GUI and the document as mutually dependent, but I believe that this would be poor design.
Does anyone have any pertinent wisdom about how to lay this out?
thanks!
JennyP
|
|
|
|
|
I would place the functions in the listview class since they alter listview behavior. If you place them in the document, you'll have to redesign (or replicate code) if you find you need additional document types in the future. Even if you don't need additional documents, you're more likely to find listview code samples on CodeProject, and that may save you some coding time.
|
|
|
|
|
Are there circumstances when calling Enable3DControls is necessary? I run Win2000 and it makes no difference whether this function is called during InitInstance. The MS doc says 3D controls are automatic on newer versions of Windows. Does that include Win95 and Up? The reason I ask is because adding this line of code adds 10-20 KB to your app (everything counts...lol)
Henry P.
|
|
|
|
|
That call is only required if you plan on running on NT 3.51
--Mike--
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
WinNT 3.51 still exists?? lol...I think I'll get rid of that line. Thanks.
Henry P.
|
|
|
|
|
I am building an SDI app with the CFormView Base Class. With in this program I have an array (CObArray m_aParts). I have added a dialog to the project with a CListBox control for display a list of items that are found in the array. I have included the dialog header file in the Doc class and vice versa. For some reason I cannot get my dialog class to retrieve information from the Doc (so it can populate the list box).
I am new to programming and have experimente by trying...
// Get pointer to currnet doc.
CProject4Doc* pDoc = GetDocument();
if (pDoc)
This only returns an error. I've tried assembling a CObArray object in the dialog and found out that it's impossible.
Than k you for any guidance.
Garry
|
|
|
|
|
GetDocument only works from the View class. You need to do this:
CProject4Doc * pDoc = (CProject4Doc *) (CMainFrame*)AfxGetMainWnd())->GetActiveDocument();
Something like that. GetMainWnd needs to be cast to your mainframe class, then it has a method which returns the document, which also needs casting.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Thanks a lot Christian. I haven't been able to get it to work yet, but feel as though I am on the right track. I appreciate your assistance.
Garry
|
|
|
|
|
error C2039: 'GetActiveDocument' : is not a member of 'CHpcComDoc'
why?? Can you help me??
|
|
|
|
|
Where do you code CProject4Doc* pDoc = GetDocument()?
You cannot get access to the document class inside of a dialog box class. There are several solution to getting access to data in a document class from a dialog box. A good solution depends on several factors include when you declare the dialog box. For example, if you delared the dialog box in a view class, then you could send a message to main frame and route the message to the view class. You could then pass data to the dialog box via public function.
Kuphryn
|
|
|
|