![]() |
|
|||||||
| Recherche & Développement Application, Algorithme, reverse engineering, entraide entre développeur, idée et autres. |
|
|
|
Outils de la discussion | Rechercher |
|
|
#16 |
|
Genious T-E
![]() Date d'inscription: décembre 2011
Localisation: france,bourgogne
Messages: 3 138
Thanks: 2 075
Thanked 4 907 Times in 1 917 Posts
Pouvoir de réputation: 82 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
slm PIC chokran très intéressant frère barak allahofik
__________________
Allah se comportera avec toi comme tu te comportes avec autrui |
|
|
|
| The Following 3 Users Say Thank You to REDZONE31 For This Useful Post: |
|
|
#17 |
|
Membre trés attaché
![]() Date d'inscription: janvier 2009
Localisation: alger centre
Messages: 647
Thanks: 242
Thanked 566 Times in 238 Posts
Pouvoir de réputation: 24 ![]() ![]() ![]() ![]() ![]() ![]() |
pour crier un bouton en commence par crée sont identificateur "ID_Open" allez sur poste numéro #2 et télécharger le fichier source en C pour comprener comment je vais faire ça
Code:
#include <tchar.h> #include <windows.h> #define ID_Open 102 j'écris maintenant un pointeur de type "HWND" d'ou je vais crée mon bouton (Open) ,et sachons que le bouton c'est une fenètre (Windows) mais on l'appel fenètre enfant ,donc on utilise la meme fonction qu'on a déja utiliser pour crée notre fonètre principale (CreateWindow()" Code:
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND hwndButton;
switch (message) /* handle the messages */
{
case WM_CREATE:
{
hwndButton = CreateWindow(
_T("BUTTON"), // Predefined class; Unicode assumed
_T("OPEN"), // Button text
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, // Styles
10, // x position
10, // y position
100, // Button width
30, // Button height
hwnd, // Parent window
(HMENU)ID_Open, // No menu.
(HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE),
NULL); // Pointer not needed.
}
break;
j'ais met en couleur les choses que je les cité dans mon commentaire
__________________
programmation apl & micropic12/16/18 communication i2c/spi/microwire/usb/rs232/rs485/jtag/CANbus |
|
|
|
| The Following 3 Users Say Thank You to PIC16F84 For This Useful Post: |
|
|
#18 |
|
Membre trés attaché
![]() Date d'inscription: janvier 2009
Localisation: alger centre
Messages: 647
Thanks: 242
Thanked 566 Times in 238 Posts
Pouvoir de réputation: 24 ![]() ![]() ![]() ![]() ![]() ![]() |
on ne peut crée notre bouton qu'après la réception de "WM_CREATE" envoyé par le System Windows , le "WM_CREATE" = (Windows Message Create)
et pour traiter un message d'un bouton dans notre logiciel sachons que quand vous cliquer sur un bouton vous allez envoyer un message au System Windows avec sont identifier (ID_Open) et le Windows renvoi ce message a notre logiciel donc tous vous clique sur une application graphique passe par Windows ,et pour nous recevoir les qui vient de Windows a notre logiciel on traite le message " Code:
case WM_COMMAND:
{
switch(LOWORD(wParam))
{
case ID_Open:
{
/* ici au plus tard on appel la boite de dialogue "Ouvrir fichier"*/
}
break;
}
}
Code:
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
__________________
programmation apl & micropic12/16/18 communication i2c/spi/microwire/usb/rs232/rs485/jtag/CANbus |
|
|
|
| The Following 3 Users Say Thank You to PIC16F84 For This Useful Post: |
|
|
#19 |
|
Membre trés attaché
![]() Date d'inscription: janvier 2009
Localisation: alger centre
Messages: 647
Thanks: 242
Thanked 566 Times in 238 Posts
Pouvoir de réputation: 24 ![]() ![]() ![]() ![]() ![]() ![]() |
pour vérifier que le traitement de mon bouton est bien dans mon logiciel j'utilse la boite de dialogue message "MessageBox()"
Code:
case ID_Open:
{
MessageBox (NULL,
_T("hi les amis le boubon Open il fonction comme je vous a dit lolll "),
_T("http://www.tlemcen-electronic.com/forum"),
MB_ICONEXCLAMATION|MB_YESNO);
}
break;
__________________
programmation apl & micropic12/16/18 communication i2c/spi/microwire/usb/rs232/rs485/jtag/CANbus |
|
|
|
| The Following 3 Users Say Thank You to PIC16F84 For This Useful Post: |
|
|
#20 |
|
Membre trés attaché
![]() Date d'inscription: janvier 2009
Localisation: alger centre
Messages: 647
Thanks: 242
Thanked 566 Times in 238 Posts
Pouvoir de réputation: 24 ![]() ![]() ![]() ![]() ![]() ![]() |
ici voila comment appeler laboite de dialogue ouvrir fichier
Code:
case ID_Open:
{
OPENFILENAME ofn;
UCHAR* O_buffer;
char lpszFile[MAX_PATH] = "";
char lpszFileTitle[MAX_PATH] = "";
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof (OPENFILENAME);
ofn.hwndOwner = hwnd;
ofn.lpstrFilter = "Binaire (*.bin)\0*.bin\0"; //Tous (*.*)\0*.*\0
ofn.lpstrFile = lpszFile;
ofn.nMaxFile = sizeof(lpszFile) / sizeof(lpszFile[0]);
ofn.lpstrFileTitle = lpszFileTitle;
ofn.nMaxFileTitle = sizeof(lpszFileTitle) / sizeof(lpszFileTitle[0]);
ofn.Flags = OFN_EXPLORER|OFN_HIDEREADONLY|OFN_CREATEPROMPT;
if (GetOpenFileName(&ofn))
{
HANDLE O_hfile;
DWORD FileSize,nbcharRead ;
O_hfile = CreateFile(ofn.lpstrFile,GENERIC_READ,0,NULL,OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,NULL);
FileSize = GetFileSize(O_hfile,NULL);
O_buffer = (UCHAR*)LocalAlloc(LMEM_FIXED,FileSize+1);
ReadFile(O_hfile,O_buffer,FileSize,&nbcharRead,NULL) ;
O_buffer[FileSize] = 0;
LocalFree(O_buffer);
CloseHandle(O_hfile);
//SendMessage(hsb, SB_SETTEXT,0,(LONG)ofn.lpstrFile);
//DialogBox((HINSTANCE)hInst,MAKEINTRESOURCE(DLG1_MAIN),NULL,(DLGPROC)Dialog1Proc);
//MessageBox(hwnd, "You clicked \"Test\" button!", "Information",MB_ICONINFORMATION);
return 0;
}
Forme = 0;
}
break;
Code:
#ifndef _COMMDLG_H
#define _COMMDLG_H
#if __GNUC__ >=3
#pragma GCC system_header
#endif
#ifdef __cplusplus
extern "C" {
#endif
#pragma pack(push,1)
#define LBSELCHSTRINGA "commdlg_LBSelChangedNotify"
#define SHAREVISTRINGA "commdlg_ShareViolation"
#define FILEOKSTRINGA "commdlg_FileNameOK"
#define COLOROKSTRINGA "commdlg_ColorOK"
#define SETRGBSTRINGA "commdlg_SetRGBColor"
#define HELPMSGSTRINGA "commdlg_help"
#define FINDMSGSTRINGA "commdlg_FindReplace"
#define LBSELCHSTRINGW L"commdlg_LBSelChangedNotify"
#define SHAREVISTRINGW L"commdlg_ShareViolation"
#define FILEOKSTRINGW L"commdlg_FileNameOK"
#define COLOROKSTRINGW L"commdlg_ColorOK"
#define SETRGBSTRINGW L"commdlg_SetRGBColor"
#define HELPMSGSTRINGW L"commdlg_help"
#define FINDMSGSTRINGW L"commdlg_FindReplace"
#ifndef CDN_FIRST
#define CDN_FIRST ((UINT)-601) /* also in commctrl.h */
#define CDN_LAST ((UINT)-699)
#endif
#define CDN_INITDONE CDN_FIRST
#define CDN_SELCHANGE (CDN_FIRST-1U)
#define CDN_FOLDERCHANGE (CDN_FIRST-2U)
#define CDN_SHAREVIOLATION (CDN_FIRST-3U)
#define CDN_HELP (CDN_FIRST-4U)
#define CDN_FILEOK (CDN_FIRST-5U)
#define CDN_TYPECHANGE (CDN_FIRST-6U)
#define CDM_FIRST (WM_USER+100)
#define CDM_LAST (WM_USER+200)
#define CDM_GETSPEC CDM_FIRST
#define CDM_GETFILEPATH (CDM_FIRST+1)
#define CDM_GETFOLDERPATH (CDM_FIRST+2)
#define CDM_GETFOLDERIDLIST (CDM_FIRST+3)
#define CDM_SETCONTROLTEXT (CDM_FIRST+4)
#define CDM_HIDECONTROL (CDM_FIRST+5)
#define CDM_SETDEFEXT (CDM_FIRST+6)
#define CC_RGBINIT 1
#define CC_FULLOPEN 2
#define CC_PREVENTFULLOPEN 4
#define CC_SHOWHELP 8
#define CC_ENABLEHOOK 16
#define CC_ENABLETEMPLATE 32
#define CC_ENABLETEMPLATEHANDLE 64
#define CC_SOLIDCOLOR 128
#define CC_ANYCOLOR 256
#define CF_SCREENFONTS 1
#define CF_PRINTERFONTS 2
#define CF_BOTH 3
#define CF_SHOWHELP 4
#define CF_ENABLEHOOK 8
#define CF_ENABLETEMPLATE 16
#define CF_ENABLETEMPLATEHANDLE 32
#define CF_INITTOLOGFONTSTRUCT 64
#define CF_USESTYLE 128
#define CF_EFFECTS 256
#define CF_APPLY 512
#define CF_ANSIONLY 1024
#define CF_SCRIPTSONLY CF_ANSIONLY
#define CF_NOVECTORFONTS 2048
#define CF_NOOEMFONTS 2048
#define CF_NOSIMULATIONS 4096
#define CF_LIMITSIZE 8192
#define CF_FIXEDPITCHONLY 16384
#define CF_WYSIWYG 32768
#define CF_FORCEFONTEXIST 65536
#define CF_SCALABLEONLY 131072
#define CF_TTONLY 262144
#define CF_NOFACESEL 524288
#define CF_NOSTYLESEL 1048576
#define CF_NOSIZESEL 2097152
#define CF_SELECTSCRIPT 4194304
#define CF_NOSCRIPTSEL 8388608
#define CF_NOVERTFONTS 0x1000000
#define SIMULATED_FONTTYPE 0x8000
#define PRINTER_FONTTYPE 0x4000
#define SCREEN_FONTTYPE 0x2000
#define BOLD_FONTTYPE 0x100
#define ITALIC_FONTTYPE 0x0200
#define REGULAR_FONTTYPE 0x0400
#define WM_CHOOSEFONT_GETLOGFONT (WM_USER+1)
#define WM_CHOOSEFONT_SETLOGFONT (WM_USER+101)
#define WM_CHOOSEFONT_SETFLAGS (WM_USER+102)
#define OFN_ALLOWMULTISELECT 512
#define OFN_CREATEPROMPT 0x2000
#define OFN_ENABLEHOOK 32
#define OFN_ENABLESIZING 0x800000
#define OFN_ENABLETEMPLATE 64
#define OFN_ENABLETEMPLATEHANDLE 128
#define OFN_EXPLORER 0x80000
#define OFN_EXTENSIONDIFFERENT 0x400
#define OFN_FILEMUSTEXIST 0x1000
#define OFN_HIDEREADONLY 4
#define OFN_LONGNAMES 0x200000
#define OFN_NOCHANGEDIR 8
#define OFN_NODEREFERENCELINKS 0x100000
#define OFN_NOLONGNAMES 0x40000
#define OFN_NONETWORKBUTTON 0x20000
#define OFN_NOREADONLYRETURN 0x8000
#define OFN_NOTESTFILECREATE 0x10000
#define OFN_NOVALIDATE 256
#define OFN_OVERWRITEPROMPT 2
#define OFN_PATHMUSTEXIST 0x800
#define OFN_READONLY 1
#define OFN_SHAREAWARE 0x4000
#define OFN_SHOWHELP 16
#define OFN_SHAREFALLTHROUGH 2
#define OFN_SHARENOWARN 1
#define OFN_SHAREWARN 0
#define OFN_NODEREFERENCELINKS 0x100000
#if (_WIN32_WINNT >= 0x0500)
#define OFN_DONTADDTORECENT 0x02000000
#endif
#define FR_DIALOGTERM 64
#define FR_DOWN 1
#define FR_ENABLEHOOK 256
#define FR_ENABLETEMPLATE 512
#define FR_ENABLETEMPLATEHANDLE 0x2000
#define FR_FINDNEXT 8
#define FR_HIDEUPDOWN 0x4000
#define FR_HIDEMATCHCASE 0x8000
#define FR_HIDEWHOLEWORD 0x10000
#define FR_MATCHALEFHAMZA 0x80000000
#define FR_MATCHCASE 4
#define FR_MATCHDIAC 0x20000000
#define FR_MATCHKASHIDA 0x40000000
#define FR_NOMATCHCASE 0x800
#define FR_NOUPDOWN 0x400
#define FR_NOWHOLEWORD 4096
#define FR_REPLACE 16
#define FR_REPLACEALL 32
#define FR_SHOWHELP 128
#define FR_WHOLEWORD 2
#define PD_ALLPAGES 0x00000000
#define PD_SELECTION 0x00000001
#define PD_PAGENUMS 0x00000002
#define PD_NOSELECTION 0x00000004
#define PD_NOPAGENUMS 0x00000008
#define PD_COLLATE 0x00000010
#define PD_PRINTTOFILE 0x00000020
#define PD_PRINTSETUP 0x00000040
#define PD_NOWARNING 0x00000080
#define PD_RETURNDC 0x00000100
#define PD_RETURNIC 0x00000200
#define PD_RETURNDEFAULT 0x00000400
#define PD_SHOWHELP 0x00000800
#define PD_ENABLEPRINTHOOK 0x00001000
#define PD_ENABLESETUPHOOK 0x00002000
#define PD_ENABLEPRINTTEMPLATE 0x00004000
#define PD_ENABLESETUPTEMPLATE 0x00008000
#define PD_ENABLEPRINTTEMPLATEHANDLE 0x00010000
#define PD_ENABLESETUPTEMPLATEHANDLE 0x00020000
#define PD_USEDEVMODECOPIES 0x00040000
#define PD_USEDEVMODECOPIESANDCOLLATE 0x00040000
#define PD_DISABLEPRINTTOFILE 0x00080000
#define PD_HIDEPRINTTOFILE 0x00100000
#define PD_NONETWORKBUTTON 0x00200000
#if (_WIN32_WINNT >= 0x0500)
#define PD_CURRENTPAGE 0x00400000
#define PD_NOCURRENTPAGE 0x00800000
#define PD_EXCLUSIONFLAGS 0x01000000
#define PD_USELARGETEMPLATE 0x10000000
#define PD_RESULT_CANCEL 0
#define PD_RESULT_PRINT 1
#define PD_RESULT_APPLY 2
#define START_PAGE_GENERAL 0XFFFFFFFF
#endif
#define PSD_DEFAULTMINMARGINS 0
#define PSD_INWININIINTLMEASURE 0
#define PSD_MINMARGINS 1
#define PSD_MARGINS 2
#define PSD_INTHOUSANDTHSOFINCHES 4
#define PSD_INHUNDREDTHSOFMILLIMETERS 8
#define PSD_DISABLEMARGINS 16
#define PSD_DISABLEPRINTER 32
#define PSD_NOWARNING 128
#define PSD_DISABLEORIENTATION 256
#define PSD_DISABLEPAPER 512
#define PSD_RETURNDEFAULT 1024
#define PSD_SHOWHELP 2048
#define PSD_ENABLEPAGESETUPHOOK 8192
#define PSD_ENABLEPAGESETUPTEMPLATE 0x8000
#define PSD_ENABLEPAGESETUPTEMPLATEHANDLE 0x20000
#define PSD_ENABLEPAGEPAINTHOOK 0x40000
#define PSD_DISABLEPAGEPAINTING 0x80000
#define WM_PSD_PAGESETUPDLG WM_USER
#define WM_PSD_FULLPAGERECT (WM_USER+1)
#define WM_PSD_MINMARGINRECT (WM_USER+2)
#define WM_PSD_MARGINRECT (WM_USER+3)
#define WM_PSD_GREEKTEXTRECT (WM_USER+4)
#define WM_PSD_ENVSTAMPRECT (WM_USER+5)
#define WM_PSD_YAFULLPAGERECT (WM_USER+6)
#define CD_LBSELNOITEMS (-1)
#define CD_LBSELCHANGE 0
#define CD_LBSELSUB 1
#define CD_LBSELADD 2
#define DN_DEFAULTPRN 1
#if (_WIN32_WINNT >= 0x0500)
#define OPENFILENAME_SIZE_VERSION_400 76
#endif
#ifndef SNDMSG
#ifdef __cplusplus
#define SNDMSG ::SendMessage
#else
#define SNDMSG SendMessage
#endif
#endif /* ifndef SNDMSG */
#define CommDlg_OpenSave_GetSpec(d,s,m) ((int)SNDMSG((d),CDM_GETSPEC,(m),(LPARAM)(s)))
#define CommDlg_OpenSave_GetSpecA CommDlg_OpenSave_GetSpec
#define CommDlg_OpenSave_GetSpecW CommDlg_OpenSave_GetSpec
#define CommDlg_OpenSave_GetFilePath(d,s,m) ((int)SNDMSG((d),CDM_GETFILEPATH,(m),(LPARAM)(s)))
#define CommDlg_OpenSave_GetFilePathA CommDlg_OpenSave_GetFilePath
#define CommDlg_OpenSave_GetFilePathW CommDlg_OpenSave_GetFilePath
#define CommDlg_OpenSave_GetFolderPath(d,s,m) ((int)SNDMSG((d),CDM_GETFOLDERPATH,(m),(LPARAM)(LPSTR)(s)))
#define CommDlg_OpenSave_GetFolderPathA CommDlg_OpenSave_GetFolderPath
#define CommDlg_OpenSave_GetFolderPathW CommDlg_OpenSave_GetFolderPath
#define CommDlg_OpenSave_GetFolderIDList(d,i,m) ((int)SNDMSG((d),CDM_GETFOLDERIDLIST,(m),(LPARAM)(i)))
#define CommDlg_OpenSave_SetControlText(d,i,t) ((void)SNDMSG((d),CDM_SETCONTROLTEXT,(i),(LPARAM)(t)))
#define CommDlg_OpenSave_HideControl(d,i) ((void)SNDMSG((d),CDM_HIDECONTROL,(i),0))
#define CommDlg_OpenSave_SetDefExt(d,e) ((void)SNDMSG((d),CDM_SETDEFEXT,0,(LPARAM)(e)))
typedef UINT (APIENTRY *__CDHOOKPROC)(HWND,UINT,WPARAM,LPARAM);
typedef __CDHOOKPROC LPCCHOOKPROC;
typedef __CDHOOKPROC LPCFHOOKPROC;
typedef __CDHOOKPROC LPFRHOOKPROC;
typedef __CDHOOKPROC LPOFNHOOKPROC;
typedef __CDHOOKPROC LPPAGEPAINTHOOK;
typedef __CDHOOKPROC LPPAGESETUPHOOK;
typedef __CDHOOKPROC LPSETUPHOOKPROC;
typedef __CDHOOKPROC LPPRINTHOOKPROC;
typedef struct tagCHOOSECOLORA {
DWORD lStructSize;
HWND hwndOwner;
HWND hInstance;
COLORREF rgbResult;
COLORREF* lpCustColors;
DWORD Flags;
LPARAM lCustData;
LPCCHOOKPROC lpfnHook;
LPCSTR lpTemplateName;
} CHOOSECOLORA,*LPCHOOSECOLORA;
typedef struct tagCHOOSECOLORW {
DWORD lStructSize;
HWND hwndOwner;
HWND hInstance;
COLORREF rgbResult;
COLORREF* lpCustColors;
DWORD Flags;
LPARAM lCustData;
LPCCHOOKPROC lpfnHook;
LPCWSTR lpTemplateName;
} CHOOSECOLORW,*LPCHOOSECOLORW;
typedef struct tagCHOOSEFONTA {
DWORD lStructSize;
HWND hwndOwner;
HDC hDC;
LPLOGFONTA lpLogFont;
INT iPointSize;
DWORD Flags;
DWORD rgbColors;
LPARAM lCustData;
LPCFHOOKPROC lpfnHook;
LPCSTR lpTemplateName;
HINSTANCE hInstance;
LPSTR lpszStyle;
WORD nFontType;
WORD ___MISSING_ALIGNMENT__;
INT nSizeMin;
INT nSizeMax;
} CHOOSEFONTA,*LPCHOOSEFONTA;
typedef struct tagCHOOSEFONTW {
DWORD lStructSize;
HWND hwndOwner;
HDC hDC;
LPLOGFONTW lpLogFont;
INT iPointSize;
DWORD Flags;
DWORD rgbColors;
LPARAM lCustData;
LPCFHOOKPROC lpfnHook;
LPCWSTR lpTemplateName;
HINSTANCE hInstance;
LPWSTR lpszStyle;
WORD nFontType;
WORD ___MISSING_ALIGNMENT__;
INT nSizeMin;
INT nSizeMax;
} CHOOSEFONTW,*LPCHOOSEFONTW;
typedef struct tagDEVNAMES {
WORD wDriverOffset;
WORD wDeviceOffset;
WORD wOutputOffset;
WORD wDefault;
} DEVNAMES,*LPDEVNAMES;
typedef struct {
DWORD lStructSize;
HWND hwndOwner;
HINSTANCE hInstance;
DWORD Flags;
LPSTR lpstrFindWhat;
LPSTR lpstrReplaceWith;
WORD wFindWhatLen;
WORD wReplaceWithLen;
LPARAM lCustData;
LPFRHOOKPROC lpfnHook;
LPCSTR lpTemplateName;
} FINDREPLACEA,*LPFINDREPLACEA;
typedef struct {
DWORD lStructSize;
HWND hwndOwner;
HINSTANCE hInstance;
DWORD Flags;
LPWSTR lpstrFindWhat;
LPWSTR lpstrReplaceWith;
WORD wFindWhatLen;
WORD wReplaceWithLen;
LPARAM lCustData;
LPFRHOOKPROC lpfnHook;
LPCWSTR lpTemplateName;
} FINDREPLACEW,*LPFINDREPLACEW;
typedef struct tagOFNA {
DWORD lStructSize;
HWND hwndOwner;
HINSTANCE hInstance;
LPCSTR lpstrFilter;
LPSTR lpstrCustomFilter;
DWORD nMaxCustFilter;
DWORD nFilterIndex;
LPSTR lpstrFile;
DWORD nMaxFile;
LPSTR lpstrFileTitle;
DWORD nMaxFileTitle;
LPCSTR lpstrInitialDir;
LPCSTR lpstrTitle;
DWORD Flags;
WORD nFileOffset;
WORD nFileExtension;
LPCSTR lpstrDefExt;
DWORD lCustData;
LPOFNHOOKPROC lpfnHook;
LPCSTR lpTemplateName;
#if (_WIN32_WINNT >= 0x0500)
void * pvReserved;
DWORD dwReserved;
DWORD FlagsEx;
#endif /* (_WIN32_WINNT >= 0x0500) */
} OPENFILENAMEA,*LPOPENFILENAMEA;
typedef struct tagOFNW {
DWORD lStructSize;
HWND hwndOwner;
HINSTANCE hInstance;
LPCWSTR lpstrFilter;
LPWSTR lpstrCustomFilter;
DWORD nMaxCustFilter;
DWORD nFilterIndex;
LPWSTR lpstrFile;
DWORD nMaxFile;
LPWSTR lpstrFileTitle;
DWORD nMaxFileTitle;
LPCWSTR lpstrInitialDir;
LPCWSTR lpstrTitle;
DWORD Flags;
WORD nFileOffset;
WORD nFileExtension;
LPCWSTR lpstrDefExt;
DWORD lCustData;
LPOFNHOOKPROC lpfnHook;
LPCWSTR lpTemplateName;
#if (_WIN32_WINNT >= 0x0500)
void * pvReserved;
DWORD dwReserved;
DWORD FlagsEx;
#endif /* (_WIN32_WINNT >= 0x0500) */
} OPENFILENAMEW,*LPOPENFILENAMEW;
typedef struct _OFNOTIFYA {
NMHDR hdr;
LPOPENFILENAMEA lpOFN;
LPSTR pszFile;
} OFNOTIFYA,*LPOFNOTIFYA;
typedef struct _OFNOTIFYW {
NMHDR hdr;
LPOPENFILENAMEW lpOFN;
LPWSTR pszFile;
} OFNOTIFYW,*LPOFNOTIFYW;
typedef struct tagPSDA {
DWORD lStructSize;
HWND hwndOwner;
HGLOBAL hDevMode;
HGLOBAL hDevNames;
DWORD Flags;
POINT ptPaperSize;
RECT rtMinMargin;
RECT rtMargin;
HINSTANCE hInstance;
LPARAM lCustData;
LPPAGESETUPHOOK lpfnPageSetupHook;
LPPAGEPAINTHOOK lpfnPagePaintHook;
LPCSTR lpPageSetupTemplateName;
HGLOBAL hPageSetupTemplate;
} PAGESETUPDLGA,*LPPAGESETUPDLGA;
typedef struct tagPSDW {
DWORD lStructSize;
HWND hwndOwner;
HGLOBAL hDevMode;
HGLOBAL hDevNames;
DWORD Flags;
POINT ptPaperSize;
RECT rtMinMargin;
RECT rtMargin;
HINSTANCE hInstance;
LPARAM lCustData;
LPPAGESETUPHOOK lpfnPageSetupHook;
LPPAGEPAINTHOOK lpfnPagePaintHook;
LPCWSTR lpPageSetupTemplateName;
HGLOBAL hPageSetupTemplate;
} PAGESETUPDLGW,*LPPAGESETUPDLGW;
typedef struct tagPDA {
DWORD lStructSize;
HWND hwndOwner;
HANDLE hDevMode;
HANDLE hDevNames;
HDC hDC;
DWORD Flags;
WORD nFromPage;
WORD nToPage;
WORD nMinPage;
WORD nMaxPage;
WORD nCopies;
HINSTANCE hInstance;
DWORD lCustData;
LPPRINTHOOKPROC lpfnPrintHook;
LPSETUPHOOKPROC lpfnSetupHook;
LPCSTR lpPrintTemplateName;
LPCSTR lpSetupTemplateName;
HANDLE hPrintTemplate;
HANDLE hSetupTemplate;
} PRINTDLGA,*LPPRINTDLGA;
typedef struct tagPDW {
DWORD lStructSize;
HWND hwndOwner;
HANDLE hDevMode;
HANDLE hDevNames;
HDC hDC;
DWORD Flags;
WORD nFromPage;
WORD nToPage;
WORD nMinPage;
WORD nMaxPage;
WORD nCopies;
HINSTANCE hInstance;
DWORD lCustData;
LPPRINTHOOKPROC lpfnPrintHook;
LPSETUPHOOKPROC lpfnSetupHook;
LPCWSTR lpPrintTemplateName;
LPCWSTR lpSetupTemplateName;
HANDLE hPrintTemplate;
HANDLE hSetupTemplate;
} PRINTDLGW,*LPPRINTDLGW;
#if (WINVER >= 0x0500) && !defined (_OBJC_NO_COM)
#include <unknwn.h> /* for LPUNKNOWN */
#include <prsht.h> /* for HPROPSHEETPAGE */
typedef struct tagPRINTPAGERANGE {
DWORD nFromPage;
DWORD nToPage;
} PRINTPAGERANGE, *LPPRINTPAGERANGE;
typedef struct tagPDEXA {
DWORD lStructSize;
HWND hwndOwner;
HGLOBAL hDevMode;
HGLOBAL hDevNames;
HDC hDC;
DWORD Flags;
DWORD Flags2;
DWORD ExclusionFlags;
DWORD nPageRanges;
DWORD nMaxPageRanges;
LPPRINTPAGERANGE lpPageRanges;
DWORD nMinPage;
DWORD nMaxPage;
DWORD nCopies;
HINSTANCE hInstance;
LPCSTR lpPrintTemplateName;
LPUNKNOWN lpCallback;
DWORD nPropertyPages;
HPROPSHEETPAGE *lphPropertyPages;
DWORD nStartPage;
DWORD dwResultAction;
} PRINTDLGEXA, *LPPRINTDLGEXA;
typedef struct tagPDEXW {
DWORD lStructSize;
HWND hwndOwner;
HGLOBAL hDevMode;
HGLOBAL hDevNames;
HDC hDC;
DWORD Flags;
DWORD Flags2;
DWORD ExclusionFlags;
DWORD nPageRanges;
DWORD nMaxPageRanges;
LPPRINTPAGERANGE lpPageRanges;
DWORD nMinPage;
DWORD nMaxPage;
DWORD nCopies;
HINSTANCE hInstance;
LPCWSTR lpPrintTemplateName;
LPUNKNOWN lpCallback;
DWORD nPropertyPages;
HPROPSHEETPAGE *lphPropertyPages;
DWORD nStartPage;
DWORD dwResultAction;
} PRINTDLGEXW, *LPPRINTDLGEXW;
#endif /* WINVER >= 0x0500 */
BOOL WINAPI ChooseColorA(LPCHOOSECOLORA);
BOOL WINAPI ChooseColorW(LPCHOOSECOLORW);
BOOL WINAPI ChooseFontA(LPCHOOSEFONTA);
BOOL WINAPI ChooseFontW(LPCHOOSEFONTW);
DWORD WINAPI CommDlgExtendedError(void);
HWND WINAPI FindTextA(LPFINDREPLACEA);
HWND WINAPI FindTextW(LPFINDREPLACEW);
short WINAPI GetFileTitleA(LPCSTR,LPSTR,WORD);
short WINAPI GetFileTitleW(LPCWSTR,LPWSTR,WORD);
BOOL WINAPI GetOpenFileNameA(LPOPENFILENAMEA);
BOOL WINAPI GetOpenFileNameW(LPOPENFILENAMEW);
BOOL WINAPI GetSaveFileNameA(LPOPENFILENAMEA);
BOOL WINAPI GetSaveFileNameW(LPOPENFILENAMEW);
BOOL WINAPI PageSetupDlgA(LPPAGESETUPDLGA);
BOOL WINAPI PageSetupDlgW(LPPAGESETUPDLGW);
BOOL WINAPI PrintDlgA(LPPRINTDLGA);
BOOL WINAPI PrintDlgW(LPPRINTDLGW);
HWND WINAPI ReplaceTextA(LPFINDREPLACEA);
HWND WINAPI ReplaceTextW(LPFINDREPLACEW);
#if (WINVER >= 0x0500) && !defined (_OBJC_NO_COM)
HRESULT WINAPI PrintDlgExA(LPPRINTDLGEXA);
HRESULT WINAPI PrintDlgExW(LPPRINTDLGEXW);
#endif /* WINVER >= 0x0500 */
#ifdef UNICODE
#define LBSELCHSTRING LBSELCHSTRINGW
#define SHAREVISTRING SHAREVISTRINGW
#define FILEOKSTRING FILEOKSTRINGW
#define COLOROKSTRING COLOROKSTRINGW
#define SETRGBSTRING SETRGBSTRINGW
#define HELPMSGSTRING HELPMSGSTRINGW
#define FINDMSGSTRING FINDMSGSTRINGW
typedef CHOOSECOLORW CHOOSECOLOR,*LPCHOOSECOLOR;
typedef CHOOSEFONTW CHOOSEFONT,*LPCHOOSEFONT;
typedef FINDREPLACEW FINDREPLACE,*LPFINDREPLACE;
typedef OPENFILENAMEW OPENFILENAME,*LPOPENFILENAME;
typedef OFNOTIFYW OFNOTIFY,*LPOFNOTIFY;
typedef PAGESETUPDLGW PAGESETUPDLG,*LPPAGESETUPDLG;
typedef PRINTDLGW PRINTDLG,*LPPRINTDLG;
#define ChooseColor ChooseColorW
#define ChooseFont ChooseFontW
#define FindText FindTextW
#define GetFileTitle GetFileTitleW
#define GetOpenFileName GetOpenFileNameW
#define GetSaveFileName GetSaveFileNameW
#define PageSetupDlg PageSetupDlgW
#define PrintDlg PrintDlgW
#define ReplaceText ReplaceTextW
#if (WINVER >= 0x0500) && !defined (_OBJC_NO_COM)
typedef PRINTDLGEXW PRINTDLGEX, *LPPRINTDLGEX;
#define PrintDlgEx PrintDlgExW
#endif /* WINVER >= 0x0500 */
#else /* UNICODE */
#define LBSELCHSTRING LBSELCHSTRINGA
#define SHAREVISTRING SHAREVISTRINGA
#define FILEOKSTRING FILEOKSTRINGA
#define COLOROKSTRING COLOROKSTRINGA
#define SETRGBSTRING SETRGBSTRINGA
#define HELPMSGSTRING HELPMSGSTRINGA
#define FINDMSGSTRING FINDMSGSTRINGA
typedef CHOOSECOLORA CHOOSECOLOR,*LPCHOOSECOLOR;
typedef CHOOSEFONTA CHOOSEFONT,*LPCHOOSEFONT;
typedef FINDREPLACEA FINDREPLACE,*LPFINDREPLACE;
typedef OPENFILENAMEA OPENFILENAME,*LPOPENFILENAME;
typedef OFNOTIFYA OFNOTIFY,*LPOFNOTIFY;
typedef PAGESETUPDLGA PAGESETUPDLG,*LPPAGESETUPDLG;
typedef PRINTDLGA PRINTDLG,*LPPRINTDLG;
#define ChooseColor ChooseColorA
#define ChooseFont ChooseFontA
#define FindText FindTextA
#define GetFileTitle GetFileTitleA
#define GetOpenFileName GetOpenFileNameA
#define GetSaveFileName GetSaveFileNameA
#define PageSetupDlg PageSetupDlgA
#define PrintDlg PrintDlgA
#define ReplaceText ReplaceTextA
#if (WINVER >= 0x0500) && !defined (_OBJC_NO_COM)
typedef PRINTDLGEXA PRINTDLGEX, *LPPRINTDLGEX;
#define PrintDlgEx PrintDlgExA
#endif /* WINVER >= 0x0500 */
#endif /* UNICODE */
#pragma pack(pop)
#ifdef __cplusplus
}
#endif
#endif
__________________
programmation apl & micropic12/16/18 communication i2c/spi/microwire/usb/rs232/rs485/jtag/CANbus |
|
|
|
| The Following 4 Users Say Thank You to PIC16F84 For This Useful Post: |
|
|
#21 |
|
Membre trés attaché
![]() Date d'inscription: janvier 2009
Localisation: alger centre
Messages: 647
Thanks: 242
Thanked 566 Times in 238 Posts
Pouvoir de réputation: 24 ![]() ![]() ![]() ![]() ![]() ![]() |
slm
quand vous cliquer sur le bouton open vous envoi un message a Windows avec "ID_Open" , le Windows renvoi le message "WM_COMMAND" a notre logiciel suivé par "ID_Open" , et nous vérifient la veriable "wParam" après la réception de message "WM_COMMAND" Code:
case "WM_COMMAND":
{
switch(LOWORD("wParam"))
{
case "ID_Open":
{
OPENFILENAME ofn;
UCHAR* O_buffer;
char lpszFile[MAX_PATH] = "";
char lpszFileTitle[MAX_PATH] = "";
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof (OPENFILENAME);
ofn.hwndOwner = hwnd;
ofn.lpstrFilter = "Binaire(*.bin)\0*.bin\0hexadecimal(*.hex)\0*.hex\0tous(*.*)\0*.*\0"; //Tous (*.*)\0*.*\0
ofn.lpstrFile = lpszFile;
ofn.nMaxFile = sizeof(lpszFile) / sizeof(lpszFile[0]);
ofn.lpstrFileTitle = lpszFileTitle;
ofn.nMaxFileTitle = sizeof(lpszFileTitle) / sizeof(lpszFileTitle[0]);
ofn.Flags = OFN_EXPLORER|OFN_HIDEREADONLY|OFN_CREATEPROMPT|OFN_ALLOWMULTISELECT;
if (GetOpenFileName(&ofn))
{
HANDLE O_hfile;
DWORD FileSize,nbcharRead ;
O_hfile = CreateFile(ofn.lpstrFile,GENERIC_READ,0,NULL,OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,NULL);
FileSize = GetFileSize(O_hfile,NULL);
O_buffer = (UCHAR*)LocalAlloc(LMEM_FIXED,FileSize+1);
ReadFile(O_hfile,O_buffer,FileSize,&nbcharRead,NULL) ;
O_buffer[FileSize] = 0;
LocalFree(O_buffer);
CloseHandle(O_hfile);
//SendMessage(hsb, 0/*SB_SETTEXT*/,0,(LONG)ofn.lpstrFile);
//DialogBox((HINSTANCE)hInst,MAKEINTRESOURCE(DLG1_MAIN),NULL,(DLGPROC)Dialog1Proc);
//MessageBox(hwnd, "You clicked \"Test\" button!", "Information",MB_ICONINFORMATION);
return 0;
}
remise a zero la veriable "ofn" avant de l'utilise Code:
ZeroMemory(&ofn, sizeof(ofn)); Code:
ofn.lpstrFilter = "Binaire(*.bin)\0*.bin\0hexadecimal(*.hex)\0*.hex\0tous(*.*)\0*.*\0"; Code:
if (GetOpenFileName(&ofn))
{
HANDLE O_hfile;
DWORD FileSize,nbcharRead ;
O_hfile = CreateFile(ofn.lpstrFile,GENERIC_READ,0,NULL,OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,NULL);
FileSize = GetFileSize(O_hfile,NULL);
O_buffer = (UCHAR*)LocalAlloc(LMEM_FIXED,FileSize+1);
ReadFile(O_hfile,O_buffer,FileSize,&nbcharRead,NULL) ;
O_buffer[FileSize] = 0;
LocalFree(O_buffer);
CloseHandle(O_hfile);
//SendMessage(hsb, 0/*SB_SETTEXT*/,0,(LONG)ofn.lpstrFile);
//DialogBox((HINSTANCE)hInst,MAKEINTRESOURCE(DLG1_MAIN),NULL,(DLGPROC)Dialog1Proc);
//MessageBox(hwnd, "You clicked \"Test\" button!", "Information",MB_ICONINFORMATION);
return 0;
}
__________________
programmation apl & micropic12/16/18 communication i2c/spi/microwire/usb/rs232/rs485/jtag/CANbus |
|
|
|
| The Following 2 Users Say Thank You to PIC16F84 For This Useful Post: | autodiagauto (22/01/2019), sathex (17/11/2020) |
|
|
#22 |
|
Product supporter
![]() Date d'inscription: mai 2009
Localisation: Non disponible
Messages: 669
Thanks: 252
Thanked 617 Times in 273 Posts
Pouvoir de réputation: 27 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
PIC16F85,
Je salue ton courage. Mais pourquoi ne pas passer par un langage C# ou vb.net avec Visual Studio. IL te crée tes fenetres seul. Pas besoin de les codés. Tu a juste à t'occuper de vraiment code les choses importantes. |
|
|
|
| The Following 3 Users Say Thank You to UdsCanOnline For This Useful Post: |
|
|
#23 | |
|
Membre trés attaché
![]() Date d'inscription: janvier 2009
Localisation: alger centre
Messages: 647
Thanks: 242
Thanked 566 Times in 238 Posts
Pouvoir de réputation: 24 ![]() ![]() ![]() ![]() ![]() ![]() |
Citation:
pour quoi ne pas passer par un langage comme c# ou vb.net, par ce que y'a un grand differance par exemple le C c'est un langage portable ,pq je fais pas seulement des applications graphique, j'utilise pas le c# ou vb.net par ce que je ne peux pas programmer les microcontroleurs, je ne peux pas crée des fichiers dll , en langage C par exemple on peut accéder directe au noyau de système mais je me demande comme ça se fait en vb.net avec des fichies de système qui sont déja écrit en C ,comme exemple le fichier "kernel32.dll" je peux le charger directe dans mon programme a l'aide de la fontion GetModuleHandle(); puis récupérer l'adresse de la fonction "beep" par GetProcAddress(hKernel32, "Beep"); et puis on utilise la fonction beep lpBeep(3000, 600); et tous ça est fait en C donc en vb.net quand arrive dans un cas comme ça il faut obligatoirement passe en C comme le cas de C avec l'assembleur on interface le code assembleur avec le C puis revenu en C Code:
#include <stdio.h>
#include <windows.h>
#include <iostream>
typedef BOOL WINAPI BEEPFUNC(DWORD, DWORD);
int main()
{
HMODULE hKernel32 = GetModuleHandle("kernel32.dll");
BEEPFUNC * lpBeep = (BEEPFUNC *)GetProcAddress(hKernel32, "Beep");
if(lpBeep == NULL)
{
fprintf(stderr, "L'adresse de la fonction Beep n'a pas pu etre lue.\n");
}
else{
fprintf(stderr, "L'adresse de la fonction Beep lue.\n");
for(int j = 0;j < 5; j++)
{
lpBeep(3000, 600);
}
}
return 0;
}
quand tu dis avec Visual Studio. IL te crée tes fenetres seul.Pas besoin de les codés. Tu a juste à t'occuper de vraiment code les choses importantes. , pour moi c'est comme pour quoi te casse ta tète pour savoir s'il y'a Visual Studio. qui te crée tes fenetres seul, j'ai choisis pas les autres langages car j'aime C et l'Assembleur par ce que c'est des lange a bas niveaux et c'est mieux pour savoir les principes de programme l'informatique, en plus c'est pour le plaisir pas mon travaille ça, aussi quand on voit des personnes nous dit chokra pour ça nous fait plaisir
__________________
programmation apl & micropic12/16/18 communication i2c/spi/microwire/usb/rs232/rs485/jtag/CANbus |
|
|
|
|
| The Following User Says Thank You to PIC16F84 For This Useful Post: | sathex (17/11/2020) |
|
|
#24 |
|
Product supporter
![]() Date d'inscription: mai 2009
Localisation: Non disponible
Messages: 669
Thanks: 252
Thanked 617 Times in 273 Posts
Pouvoir de réputation: 27 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Oui vu de se point de vu.
Mais bon 90% sous windows. Apres pour la programmation PIc oui en effet le C |
|
|
|
|
|
#25 |
|
Membre Non Confirmé
Date d'inscription: avril 2019
Localisation: france
Âge: 50
Messages: 3
Thanks: 2
Thanked 2 Times in 2 Posts
Pouvoir de réputation: 0 ![]() |
merci beaucoup pour le lien , j'ai du boulot pour maitriser la chose !
|
|
|
|
|
|
#26 | |
|
Genious T-E
![]() Date d'inscription: juin 2014
Localisation: FR
Messages: 3 338
Thanks: 3 167
Thanked 6 197 Times in 2 435 Posts
Pouvoir de réputation: 80 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Citation:
https://www.tlemcen-electronic.com/f...ad.php?t=79387
__________________
Pas de "Thanks" plus d'aide! |
|
|
|
|
| The Following User Says Thank You to chaoui05 For This Useful Post: | klif26 (02/05/2019) |
| Sponsored Link |
![]() |
| Liens sociaux |
|
|
Discussions similaires
|
||||
| Discussion | Auteur | Forum | Réponses | Dernier message |
| acces rubrique Recherche & Développement | electronico | Café du forum | 2 | 03/07/2018 12h05 |
| Recherche & Développement ???? | rotax | Café du forum | 1 | 03/07/2018 12h05 |