Questions About Gadget,Shellcommand,Image,Network

Just starting out? Need help? Post your questions and find answers here.
netfriends
User
User
Posts: 36
Joined: Wed Jan 18, 2006 8:25 am
Contact:

Questions About Gadget,Shellcommand,Image,Network

Post by netfriends »

1) Network
When I CreateNetworkServer and a Client connect to Server,How can I get the Client's IP(Client couldn't send anything)

2) Gadget
I try to Show a BalloonTip on SysTrayIcon when comes an event.
I use under codes

Code: Select all

AddSysTrayIcon(#SysTrayIcon, WindowID(), ImageID)
BalloonTip(WindowID(), #SysTrayIcon, "This is a test", "This is a test", #TOOLTIP_WARNING_ICON)
It didn't work

3) Shellcommand
codes:

Code: Select all

Procedure.s cmdreturn(command$,timeout.l)
Protected Result$
RunProgram("cmd"," /c " + command$ + " >"+GetTempPath()+"cmd.tmp","",2)
Delay(timeout)
   If OpenFile(0, GetTempPath()+"cmd.tmp")
    
    While Eof(0) = 0 
    
    Result$ +ReadString()+#EOF 
   
    Wend

 CloseFile(0)
 EndIf
ProcedureReturn Result$
EndProcedure 
:oops: It's trouble enough,How can I get the shell retrunwords don't use ">cmd.tmp" "openfile(cmd.tmp)".:wink:

4) Image
Fuction:

Code: Select all

Procedure MakeDesktopScreenshot(ImageNr,x,y,Width,Height) 
   hImage = CreateImage(ImageNr,Width,Height) 
   hDC    = StartDrawing(ImageOutput()) 
   DeskDC = GetDC_(GetDesktopWindow_()) 
      BitBlt_(hDC,0,0,Width,Height,DeskDC,x,y,#SRCCOPY) 
   StopDrawing() 
   ReleaseDC_(GetDesktopWindow_(),DeskDC) 
   ResizeImage(ImageNr,640,480)
   ProcedureReturn hImage 
EndProcedure
I try to put the hImage's data into *imagebuffer
I use fuction CatchImage(),But It's the opposition

---------------------
Waiting for Help:P
Last edited by netfriends on Sat Oct 07, 2006 4:09 am, edited 1 time in total.
┏┓ CT+pro Studio - www_ct-pro_com
█┛ From China
┏█ MSN:ct1676@hotmail.com
┗┛ I have felt the pure power already.
|-.-|`o`|`_`|o_o|:_:|'_'|^.^|-_-!|
netfriends
User
User
Posts: 36
Joined: Wed Jan 18, 2006 8:25 am
Contact:

Post by netfriends »

Sorry,Compiling in PureBasic v3.94 :oops:
I find the under code in PB4,Is that help for solving the shellcommand problem?

Code: Select all

Debug "Running" 
numb = RunProgram("cmd", "/r ipconfig", "",#PB_Program_Hide|#PB_Program_Open|#PB_Program_Read) 

If IsProgram(numb) 
  While ProgramRunning(numb) 
    Debug ReadProgramString(numb) 
  Wend 
  Debug "Exitcode: " + Str(ProgramExitCode(numb)) 
Else 
  Debug "not a program" 
EndIf 
The functions couldn't used in PB3.94,But in PB4

Code: Select all

IsProgram() 
ProgramRunning()
ReadProgramString()
ProgramExitCode()
Can I load the PB4's libs to PB3.94?
┏┓ CT+pro Studio - www_ct-pro_com
█┛ From China
┏█ MSN:ct1676@hotmail.com
┗┛ I have felt the pure power already.
|-.-|`o`|`_`|o_o|:_:|'_'|^.^|-_-!|
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Post by Xombie »

To my knowledge, you can't. But PB v4.00 is a free upgrade from 3.94 - why not just upgrade? Unless you're using the demo version of 3.94 and then you wouldn't be able to use Windows API to run a console window either.
netfriends
User
User
Posts: 36
Joined: Wed Jan 18, 2006 8:25 am
Contact:

Post by netfriends »

Hi Xombie,It's not demo version of 3.94.
Can I load the PBOSL to PB4?
How to load?
┏┓ CT+pro Studio - www_ct-pro_com
█┛ From China
┏█ MSN:ct1676@hotmail.com
┗┛ I have felt the pure power already.
|-.-|`o`|`_`|o_o|:_:|'_'|^.^|-_-!|
Post Reply