Announcement

Collapse
No announcement yet.

Email checker in Source Code forum

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Gösta H. Lovgren-2
    replied
    Originally posted by Michael Mattias View Post
    Windows never sees a quote mark.

    PowerBASIC does that.

    When you pass a string literal as a parameter, the compiler will convert the literal to the correct type... either ASCIIZ or OLE (dynamic) string depending on what the called procedure wants.

    When you pass a dynamic string variable ("disp$") to a function (Messagebox) which wants an ASCIIZ parameter in that position... it is, yes, a '480 parameter type mismatch' error.

    Using BYCOPY (or parens) at the point of call is almost like using a literal in that the compiler will convert the value of that variable to the proper datatype for the called procedure.

    MCM
    PS: no, that is NOT in the help file, either Windows or PB
    Thank you for the clarification, M. However in my simple mind, I will still consaider a starting " as a harken to Windows (or PB or whoever) to "convert" it to a pointer to the rest of the string in question. (a pointer is called for in that position according the WinApi help/docs). It may not be literally correct but serves my purposes for understanding (at least better than your explanation.) Simple answers for simple minds and all that.

    Not questioning your interpretation (Who would dare that, really?), only that there is more than one way of understanding the world we live in. Just as I now interpret "ByCopy S$" to be the equivalent of a StrPtr variable. (And, of couirse, I now expect you to point out the fatal flaw in that logic.)

    ========================================================
    "It is time I stepped aside
    for a less experienced and less able man."
    Professor Scott Elledge on his retirement from Cornell
    ========================================================

    Leave a comment:


  • Michael Mattias
    replied
    So my conclusion is that when Windows sees a " (quote mark) it converts it to a pointer internally if it is expecting a pointer. I didn't see that (or it didn't "register" with me) in either the PB Help or the WinApi Help.
    Windows never sees a quote mark.

    PowerBASIC does that.

    When you pass a string literal as a parameter, the compiler will convert the literal to the correct type... either ASCIIZ or OLE (dynamic) string depending on what the called procedure wants.

    When you pass a dynamic string variable ("disp$") to a function (Messagebox) which wants an ASCIIZ parameter in that position... it is, yes, a '480 parameter type mismatch' error.

    Using BYCOPY (or parens) at the point of call is almost like using a literal in that the compiler will convert the value of that variable to the proper datatype for the called procedure.

    MCM
    PS: no, that is NOT in the help file, either Windows or PB

    Leave a comment:


  • Gösta H. Lovgren-2
    replied
    Originally posted by Mel Bishop View Post
    Not a problem, Gosta. Looking forward to seeing your results.

    Idle curosity: Have you replaced my "notify" routine?
    Am "planning" on keeping the Euro siren (if that's what you mean). What I'd like to do eventually (why "planning" is in quotes, Best laid plans of mice and Real men and all that) and converting it to a PBWin (DDT) gui. What I'd like to do is be able is read the mail on the server and have the prog delete/filter certain stuff from the server before my email client even reads it based on some "rules" I set up.

    I get a slug of unwanted email every day that doesn't get filtered by my junk filters for one reason or another (not important why here) and if I could delete it beforehand it would be nice, neat, cool, ...

    Nothing earthshaking, just an exercise to fend off a bored (boring?) old man's ennui.

    =============================
    "Vote early and vote often."
    Al Capone (1899-1947)
    =============================
    Last edited by Gösta H. Lovgren-2; 29 Apr 2009, 01:17 PM. Reason: accuracy in reporting

    Leave a comment:


  • Mel Bishop
    replied
    Originally posted by Gösta H. Lovgren-2 View Post
    Thanks the "stimulus", Mel.
    Not a problem, Gosta. Looking forward to seeing your results.

    Idle curosity: Have you replaced my "notify" routine?

    Leave a comment:


  • Gösta H. Lovgren-2
    replied
    Mel, I tried both ways (Disp$ & chr$(0) -Asciiz or not) and it made no difference. The WinApi said it was looking for a pointer to a string, so I even tried that but no dice. (Probably sintax (spelling intended) on my end) (later - it was, see below)

    Peter thanks the advice to look in PB Help for Call but it really wasn't clear to me what was wrong with my code, even after reading the Help (which I must conferss hadn't occurred to me before, just naturally presuming it was obviously my error).

    Here's also what works or not:
    Code:
          If MessageBox(0, disp$, _ '<<< [COLOR=red]Yields 480 "Parameter Mismatch Error[/COLOR]"
    '
    '
          If MessageBox(0, " " & disp$, _ '<<< [COLOR=red]Works with Quotes in front[/COLOR]
    '
    '
          If MessageBox(0, @sptr , _ '<<< [COLOR=red]Works with pointer variable[/COLOR]
    So my conclusion is that when Windows sees a " (quote mark) it converts it to a pointer internally if it is expecting a pointer. I didn't see that (or it didn't "register" with me) in either the PB Help or the WinApi Help.

    Thanks guys. Now on to conquering more of the Email Retrieval world. Thanks the "stimulus", Mel.

    =======================================
    “Time is very slow for those who wait,
    very fast for those who are scared,
    very long for those who lament,
    very short for those who celebrate.
    But, for those who love,
    time is eternity"
    William Shakespeare
    =======================================

    Leave a comment:


  • Peter Jinks
    replied
    Hi Gösta,

    Try
    Code:
    If MessageBox(0, [B][COLOR="Red"]BYCOPY[/COLOR][/B] disp$, _ 
                          "MainClientFinder", %MB_ICONQUESTION Or %MB_YESNO) = %IDYES Then

    Added:
    Actually, this works too:
    Code:
    If MessageBox(0,  (disp$), _ 
                          "MainClientFinder", %MB_ICONQUESTION Or %MB_YESNO) = %IDYES Then
    See the help file under "CALL statement" to see why.

    Regards,

    Pete.
    Last edited by Peter Jinks; 28 Apr 2009, 11:05 PM.

    Leave a comment:


  • Mel Bishop
    replied
    Have you tried converting "disp$" to a regular string instead of an ASCIIZ?

    I mean if "test" string works and disp$ doesn't....

    Leave a comment:


  • Gösta H. Lovgren-2
    started a topic Email checker in Source Code forum

    Email checker in Source Code forum

    I have been playing around with the Email Checker code Mel posted:
    http://www.powerbasic.com/support/pb...ad.php?t=40417
    and have run up against a puzzler:

    Code:
         ' Ask to execute mail client
         Local disp$, i&, sptr As Asciiz Ptr
         disp$ = Using$("#, Messages in your in-box: ", Num_Msgs)
          i = InStr(-1, zMailClient, "\") 'strip location
           disp$ = disp$ & Mid$(zMailClient, i + 1) 'add to display$
           disp$ = disp$ & $CrLf & $CrLf & "Run the default mail client now?" 
           disp$ = disp$ & Chr$(0) ' expects zstring
            sptr =  StrPtr(Disp$) 'tried pointer but no good either
     
    '      If MessageBox(0, disp$, _ '[COLOR=red][B]<<< Yields 480 "Parameter Mismatch Error"[/B][/COLOR]
    '                      "MainClientFinder", %MB_ICONQUESTION Or %MB_YESNO) = %IDYES Then
     
          If MessageBox(0, "test", _ [B][COLOR=red]'<<< Works[/COLOR][/B]
                          "MainClientFinder", %MB_ICONQUESTION Or %MB_YESNO) = %IDYES Then
     
      '[B][COLOR=red]```````````` Also works (original code)[/COLOR][/B]
    '    If MessageBox(0, "Messages in your in-box: " + zMailClient + $CrLf + $CrLf + "Run the default mail client now?", _
    '                     "MainClientFinder", %MB_ICONQUESTION Or %MB_YESNO) = %IDYES Then
    '
    Why does the second MessageBox work but not the first? Do I have another Dell XPS "anomaly"? Or am I doing something really really stupid (remote but not outside the realm of possibility in this modern world of Real Men {grin}).

    =========================================
    "He who loses money, loses much;
    He, who loses a friend, loses much more;
    He, who loses faith, loses all."
    Eleanor Roosevelt
    =========================================
    Last edited by Gösta H. Lovgren-2; 28 Apr 2009, 09:16 PM.
Working...
X