荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: tang (独孤九剑), 信区: Program
标  题: MSVC-BEGINNERS Digest - 14 May 1998 to 15
发信站: BBS 荔园晨风站 (Sat May 16 22:42:26 1998), 转信

There are 21 messages totalling 737 lines in this issue.

Topics of the day:

  1. Threads, Events & Process (4)
  2. Intercept WM_CLOSE in a console application (5)
  3. STL & istream problem (2)
  4. Using Microsoft Ofices spell checker? (2)
  5. OnCtlColor
  6. Beginners Question About CDialogBar
  7. try-catch
  8. Telnet Problems
  9. UserId in VC++ ?
 10. Appropriate?
 11. SQL Server for VC++
 12. How to set the focus?
Hi,

An Event is something that happens whenever something happens. I mean , when
you move your mouse, or press a key or do any damn thing that you could do
with your mouse or keyboard, what you are doing is generating an "Event".
eg., when you press your mouse's left button, you generate a WM_LBUTTONDOWN
Event.
    A process is any module that runs in memory. For faster processing,
windows (95 and NT) break a process into small parts , and process each part
parallely ( almost). these small parts are called as "Threads" .  A process
is the parent, threads are its children.
     If you want deeper understanding, try going through the book "Advanced
windows" by Jeffery Ritcher. It is one of the very few books that expalin
the 'Concepts' of windows programming.

Regards,

Raghu
Software Engineer,
Ruksun Software Technologies,
svraghu@ruksun.com

~~~~~~~~~~~~~~~~~~~
If you give me a fish, I can eat Today.
If you Teach me to fish, I can eat EveryDay.
~~~~~~~~~~~~~~~~~~~
S.Vinayak Raghuraman wrote:

>    A process is any module that runs in memory. For faster processing,
>windows (95 and NT) break a process into small parts , and process each part

>parallely ( almost). these small parts are called as "Threads" .  A process
>is the parent, threads are its children.

Thanks, I've been lurking in this list with the same question.

But what I really want to know is if anyone has written a system
monitor utility, which gives a histogram of processor usage - broken
down by individual processes.

That is, when multitasking (with Win 95) I'd like to be able to the
percentage of processor time taken by each process - and have a
graphical view of how this changes over time.


All the system monitors I've found merely note the percentage of time
the processor is not idle.


--
- Wayne M. VanWeerthuizen   Alt.Atheism Atheist#111 -
- WayneMV@LocalAccess.Com   PGP5 Key ID= 0x2CF2FB3B -
-                                                   -
-      Member of team "Libertarians for Privacy"    -
-         at http://www.distributed.net/rc5/        -
Excuse me for my OT but I've a problem that I'm not able to solve,

NT4.0 VCpp5.0 SDK Win32
I've a console application, I've to do some de-initializations
also if the application is close with the "x" button (or ALT-F4).

Probably I've to intercept the WM_CLOSE meggase,
but I haven't a window procedure.

Thank in advance

       Telemaco
Hi,

To actually track the WM_CLOSE message, I dont think you can escape from the
WndProc.

But dont you think that the de-initialization code could simply be put in
your Destructor.

Regards,
Raghu.
Wayne M. VanWeerthui Wrote,

>Thanks, I've been lurking in this list with the same question.

>But what I really want to know is if anyone has written a system
>monitor utility, which gives a histogram of processor usage - broken
>down by individual processes.

If you are using NT, Try ctrl + shift + esc

Regards,
Raghu.
svraghu@RUKSUN.COM on 05/15/98 10:29:09 AM

Please respond to MSVC-BEGINNERS@MAELSTROM.STJOHNS.EDU

To:   MSVC-BEGINNERS@MAELSTROM.STJOHNS.EDU
cc:    (bcc: Telemaco Sestini/AIS_SpA/IT)
Subject:  Re: [MSVC] Intercept WM_CLOSE in a console application




>To actually track the WM_CLOSE message,
>I dont think you can escape from the WndProc.
>But dont you think that the de-initialization
>code could simply be put in your Destructor.
Hi,
thank for your answer.

I've an old dos C prg,
and I must port it under Win32 with less work as possible.
I've only the "console windows",
I'm able to link a wndprc to a "normal window"
but how can I do that with a "console window"?

I haven't  object so there isn't destructors.

Any suggestions?

Bye
        Telemaco
     If you search through the VC5 header files you'll find that the new
     style headers (without .h) define istream differently than the old
     style headers. That explains your problem.

     The solution? One possibility would be to use an STL version that is
     based on older headers (www.objectspace.com may offer a free one).
     Another is to track down istream / ostream references and see if you
     can eliminate them ( looking at the preprocessed output would be
     useful).

     I know it's not much, but I hope it helps a bit,

        Burkhard


______________________________ Reply Separator _________________________________

Subject: [MSVC] STL & istream problem
Author:  Doug Graham <dgraham@XYPOINT.COM> at Internet
Date:    14/05/98 17:46


Can some one help me with an "istream : redefinition; different basic
types" problem?

In my .h file I am including the STL map, list and string.  I am also
declaring "using namespace std."

I have to reference a class in a library that does not use STL.  So I
have a forward declaration for this class in my .h.

When I compile my .cpp I get a redefinition error on the forward
declarations istream and ostream in the library file.  Why?

Is the compiler getting confused on which istream and ostream to use
because I am using STL in my project and the library does not use STL?

Any help appreciated.

Doug
I'm working on an email/news reader program and would like to have a
spell checking function.  Is it possible to use the spellchecker from
Microsoft Office?
If I can, how do I go about it?
If not, Is there a free (I'm a poor impoverished student) lib that I
can get to do the Job?
TIA
Gary

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  The other day upon the Stair
  I saw a man who was not there
  He was not there Again today
  I think he's from the CIA
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
On Fri, 15 May 1998 12:01:43 +0100, you wrote:

>I'm working on an email/news reader program ....

How much have you gotten done so far?  I've been part
of a discussion in a mailing list, about creating a new
newsreader.

What features will your program have?

Are you interested in reading my comments on what features
a good newsreading program should have?

I assume your program will be for 32-bit Windows?  Any
other platforms?

Do you have a web page?  (I do not.  ... yet.)
Hi,

In good old C days, I used to maintain a text file . among other things, I
used to store a certain string whenever my application exited the proper
way. When the application used to start , it first checks in the file if the
string is present. If so, I know that the application has shut down normally
(all de- initializations done). Otherwise, I could do some correcting stuff
before beginning to do anything else.

If you think this is very cumbersome, I think YOu could write a TSR that
could do some job whenever your application exits.

Hope this helps.

Regards,
Raghu.
 What about that ?
Snipped from online help
Registers a routine to be called at exit time.
_onexit_t _onexit( _onexit_t func );

Return Value
_onexit returns a pointer to the function if successful, or NULL if
there is no space to store the function pointer.
Parameter
func   Pointer to function to be called at exit
Remarks
The _onexit function is passed the address of a function (func) to be
called when the program terminates normally. Successive calls to _onexit
create a register of functions that are executed in LIFO
(last-in-first-out) order. The functions passed to _onexit cannot take
parameters.
_onexit is a Microsoft extension. For ANSI portability use atexit.
Example
  /* ONEXIT.C */
#include <stdlib.h>
#include <stdio.h>
/* Prototypes */
int fn1(void), fn2(void), fn3(void), fn4 (void);
void main( void )
{
   _onexit( fn1 );
   _onexit( fn2 );
   _onexit( fn3 );
   _onexit( fn4 );
   printf( "This is executed first.\n" );
}
int fn1()
{
   printf( "next.\n" );
   return 0;
}
int fn2()
{
   printf( "executed " );
   return 0;
}
int fn3()
{
   printf( "is " );
   return 0;
}
int fn4()
{
   printf( "This " );
   return 0;
}
Output
    This is executed first.
This is executed next.
-----Original Message-----
From:   Telemaco Sestini [SMTP:tsestini@AISMI.AIS.IT]
Sent:   Friday, May 15, 1998 11:43 AM
To:     MSVC-BEGINNERS@MAELSTROM.STJOHNS.EDU
Subject:        Re: [MSVC] Intercept WM_CLOSE in a console application

svraghu@RUKSUN.COM on 05/15/98 10:29:09 AM

Hi,
thank for your answer.

I've an old dos C prg,
and I must port it under Win32 with less work as possible.
I've only the "console windows",
I'm able to link a wndprc to a "normal window"
but how can I do that with a "console window"?

I haven't  object so there isn't destructors.

Any suggestions?

Bye
        Telemaco
VC5.0 (SP3), WinNT4.0(SP3)

Hey all,

I have a customer information screen that the user can only change data
if they have the proper permissions, otherwise, the edit controls are
grayed out.  The problem is, the gray text... I would like to change it
to black.

I am using the following code...

HBRUSH CAd32CustView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
        HBRUSH hbr = CFormView::OnCtlColor(pDC, pWnd, nCtlColor);

        if (nCtlColor == CTLCOLOR_EDIT)
        {
                pDC->SetTextColor(RGB(255, 255, 255));  // black
        }
        // TODO: Return a different brush if the default is not desired
        return hbr;
}

The problem is that this code will only work on the controls that are
not disabled.

I am using the EnableWindow(FALSE) function to disable the controls on
the form.

Am I missing something, or can you not change the color of disabled
controls?

Thanks!
-Charlie-


----------------------------
Charles R. Derk, Jr.
Software Developer, GraphX, Inc.
http://www.adtaker.com
Voice:(610) 797-5515 x131 Fax:(610)797-8740
Hi,


I am a MFC novice having some difficulty using a CDialogBar in my
application.

I have a frame window class derived from CFrameWnd

The class contains the declaration :

protected:

        CDialogBar  m_wndDlgBar;

In the constructor for my frame window class I do the following:


        if (!m_wndDlgBar.Create(this, IDD_MYDLG_TOOLBAR,
                CBRS_LEFT|CBRS_TOOLTIPS|CBRS_FLYBY, IDD_MYDLG_TOOLBAR))
        {
                TRACE0("Failed to create DlgBar\n");
                return -1;      // fail to create
        }

This seems to create and display the dialog based toolbar
satisfactorily. However, a horizontal CSliderCtrl control on the tool
bar refuses to send any WM_HSCROLL() events to the frame window. Reading
the on-line help suggests that the parent frame window will be the
target for  all the events from a dialog tool bar.

Several buttons on the tool bar are also disabled when the tool bar
appears . Is it possible to make their default state enabled ?

Any help appreciated.

Thanks,

Andy.



--
Andrew Hall
S.Vinayak Raghuraman wrote:

>     A process is any module that runs in memory. For faster processing,
> windows (95 and NT) break a process into small parts , and process each par
t
> parallely ( almost). these small parts are called as "Threads" .  A process

> is the parent, threads are its children.

Almost. The process is the running application, and includes its virtual
memory, code, data, system resources that are visible to it, and one or
more threads. A thread is a sequence of execution that runs within the
context of the process. In a single CPU system, the appearance of
concurrency is achieved by the OS allocating processor time to all
active threads by using a time-slice algorithm (Win95/NT).

Or something like that :)

Douglas Gilbert,
Calgary, Alberta.
Hi,
to catch error in my program i used code
 try
 {
  int i=0,j;j=5/i;
 }
 catch (CException &e5)
 {
  strcpy(sWhere,"Get\n");
  e5.GetErrorMessage(msg, 511);
  strcat(sWhere,msg);
  AfxMessageBox(sWhere);
  return;
 }
but program terminates like i did not use try catch.
Aleks Kleyn.
Thanks Burkard.  I did look in the istream header and the only
conclusion I could come up with was similar to what you are saying.
 VC++ is confused on whether or not to us istream (STL) or istream.h.

I did find a solution for this particular project.  If I #include the
file the problem library file into the header of my app it compiles.
 This is strange though because I only use a forward declaration in my
the other header files in my project.

Thank, Doug

----------
From:  Burkhard_Kloss@gbccmail.lehman.com
[SMTP:Burkhard_Kloss@gbccmail.lehman.com]
Sent:  Friday, May 15, 1998 3:45 AM
To:  Douglas Graham; MSVC-BEGINNERS@MAELSTROM.STJOHNS.EDU
Subject:  Re: [MSVC] STL & istream problem
I've been working on this telnet application to change a password for a
while, but still can't figure it out.  As far as I can tell, I get connected
to the server, but all I receive from it is a bunch of junk (weird
characters).
I have (in not very nice looking code so far):

 CString domain = "dotted number here";
 int daport = 23;

 CSocket m_Mysocket;
 m_Mysocket.Create();

 if(m_Mysocket.Connect(domain, daport) != 0)
 {
  MessageBox("Connected",MB_OK,0);
 }
 else
 {
  CString errMess = m_Mysocket.GetLastError();
  MessageBox(errMess,MB_OK,0);
    return;
 }

 char buffer[] = "mylogonid";
 char buffer2[200];
 CString convertStr;
 CString convertStr2;
 char buffer3[] = "xxxxxx";

 m_Mysocket.Send(buffer, sizeof(buffer),0);
 m_Mysocket.Send(buffer3, sizeof(buffer3), 0);
 m_Mysocket.Receive(buffer2, sizeof(buffer2), 0);

 MessageBox(buffer2, MB_OK, 0);

I know this isn't very professional or nice looking.  Right now I'm just
trying to get it to do something.  I've looked at using CArchive, but have
problems with that.  But any approach I take seems to give me no good
results.  Is there something in making the socket that I'm missing?
Thanks alot,
Michael
Hi All,

   How can I get UserID in VC++ ?

   In one of my MFC apps, I need get login UserId in order
   to update the database.

   Is any one there could help me on this?

thanks,
//Ramki.
"How To Write Unmaintainable Code"

http://oberon.ark.com/~roedy/unmain.html

I  enjoyed this bit of humor.  Hope you do too.

Doug
This may be a little off list.

Can anyone tell me where to find instructions for installing SQL Server
on a single PC (NT Workstation).  I want to start writing programs
around SQL Server.  To do this I want to be able to work on a single
PC.  When I install SQL Server now I have trouble getting it right.
 Like I can't see my server which should be my PC.  I have a few books
but they don't cover this type of install.

Any help appreciated.

TIA, Doug
Hi All,

   I have 3 radio buttons and corresponding 3 edit  boxes.

Q:
    When the user checks a radio button,
     How can I set the focus( cursor) to the corresponding Edit box,
     and disable the other two edit boxes?

Thanks,
--
        There are these few times I feel lonely for you.
        But I know this shade of blue will soon pass through!
        I must be strong without you by my side!
        I can see forever you are my light.

※ 来源:.BBS 荔园晨风站 bbs.szu.edu.cn.[FROM: 192.168.0.4]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店