Results 1 to 4 of 4

Thread: SendMessage Not Defined??? [RESOLVED]

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2001
    Posts
    525

    Question SendMessage Not Defined??? [RESOLVED]

    Can someone tell my why it keeps saying SendMessage "Sub or Function not defined"?

    VB Code:
    1. Call SetDefaultPrinter(Simplex, DriverName, PortName)

    VB Code:
    1. Declare Function WriteProfileString Lib "KERNEL32" _
    2. Alias "WriteProfileStringA" _
    3. (ByVal lpszSection As String, _
    4. ByVal lpszKeyName As String, _
    5. ByVal lpszString As String) As Long
    6.  
    7. Public Const HWND_BROADCAST = &HFFFF
    8. Public Const WM_WININICHANGE = &H1A
    9.  
    10. Public Sub SetDefaultPrinter(ByVal PrinterName As String, _
    11.     ByVal DriverName As String, ByVal PrinterPort As String)
    12.     Dim DeviceLine As String
    13.     Dim r As Long
    14.     Dim l As Long
    15.     DeviceLine = PrinterName & "," & DriverName & "," & PrinterPort
    16.     ' Store the new printer information in the [WINDOWS] section of
    17.     ' the WIN.INI file for the DEVICE= item
    18.     r = WriteProfileString("windows", "Device", DeviceLine)
    19.     ' Cause all applications to reload the INI file:
    20.     l = SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0, "windows")
    21. End Sub
    Last edited by jsun9; Jan 15th, 2004 at 02:02 PM.

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    because Sendmessage is an api call just like WriteProfileString
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3
    Fanatic Member
    Join Date
    Dec 2003
    Posts
    703
    Funnily enough, it's because you haven't defined it. Declare it, as you're doing for WritePrivateProfileString.
    an ending

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    May 2001
    Posts
    525
    ahh.. see, i looked for it in the demo code I got, but it was nowhere to be found.. i got it now!

    thanks guys!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width