GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEV
,
WEBDEV
e
WINDEV Mobile
Inicio
|
Mensagens recentes
|
Conecte-se...
|
Disconnect
|
Português
Inicio
→
WINDEV 2024
→
Working with pointers...
Working with pointers...
Iniciado por David, jul., 16 2004 7:03 PM - 3 respostas
Conecte-se…
David
#1
Publicado em julho, 16 2004 - 7:03 PM
I have some code in Delphi wich i need to translate to Windev but Delphi code uses pointers, does Windev have anything I can use?
Other problem is the use of overloads functions in Delphi and I don't know how to migrate it to Windev, any sugestions??
Delphi code:
function SMStartCapturing(ScannerId: PAnsiChar; ImageProc: TSMImageProc; StateProc: TSMStateProc; Param: Pointer): Integer; stdcall;
function SMGetScannerId(Index: Integer; Id: PAnsiChar; Len: Integer): Integer; stdcall; overload;
function SMGetScannerId(Index: Integer): string; overload;
best regards...
David
Denunciar
0
0
Peter Holemans
#2
Publicado em julho, 16 2004 - 9:14 PM
Hi,
1) To answer your question with regards to pointers:
In WinDev you can use the ampersand ('&')like in C/C++ sign to refer to the memory address of a variable or procedure instead of the variable value itself.
By default WinDev internally (when using W-Language) passes variables "by reference" (= memory address) instead of "by value".
Only when talking with other platforms (API's etc...) you may need explicitely pass a variable as memory address like the example below:
sWindowTitle is string ASCIIZ on 257
API("USER32","GetWindowTextA",iHwnd,&sWindowTitle,257)
For transferring string variables referenced by memory address back into a WinDev string check the Transfer() function.
2) To answer your question with regards to overloading:
As of WD8 (Maybe also WD75) overloading of procedures and even standard WinDev functions is supported. Haven't used it yet, but it should be possible.
Regards,
Peter
http://members.chello.be/cr45693/
Denunciar
0
0
Raimund Schuldhaus
#3
Publicado em julho, 16 2004 - 9:21 PM
Hello David,
use &variable if you want pass the address of a variable. Do you mean polymorphic functions if you ask about overload? Sorry then, there is no way to write polymorphic functions in WinDev. However there is way for you!
Procedure SMGetScannerId(Index is Int, Id is variant = null, Len is variant = null)
Procedure SMGetScannerId(Index is int)
You can then check in the procedure for Null on the parameters and do the appropriate action.
HTH
Raimund
I have some code in Delphi wich i need to translate to Windev but Delphi code uses pointers, does Windev have anything I can use?
Other problem is the use of overloads functions in Delphi and I don't know how to migrate it to Windev, any sugestions??
Delphi code:
function SMStartCapturing(ScannerId: PAnsiChar; ImageProc: TSMImageProc; StateProc: TSMStateProc; Param: Pointer): Integer; stdcall;
function SMGetScannerId(Index: Integer; Id: PAnsiChar; Len: Integer): Integer; stdcall; overload;
function SMGetScannerId(Index: Integer): string; overload;
best regards...
David
http://www.invitec.com
Denunciar
0
0
David
#4
Publicado em julho, 16 2004 - 9:40 PM
Thanks, you've really got it!! its to work with API's
David
Denunciar
0
0
→ Voltar para WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (versões anteriores)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Tipo de Pesquisa
Apenas tópicos
Todas as mensagens
Período de pesquisa
Qualquer momento
Última hora
Últimas 24 horas
Semana passada
Mês passado
Ano passado
Cancelar
Pré-visualização da sua mensagem
Adicionar imagem
Importar uma imagem de uma URL
Enviar uma imagem a partir do seu disco
Deixe um ficheiro ou clique em "Procurar ..."
ou
Cancelar
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Texto