sence i moved to agk here you go
resource.h
#define IDM_FILE_NEW 101
#define IDM_FILE_OPEN 102
#define IDM_FILE_SAVE 103
#define IDM_FILE_EXIT 104
#define IDM_HELP_ABOUT 105
winchat.h
#pragma once
#include "resource.h"
winpart.h
#include <string>
using namespace std;
void initwindowrectchat();
void enterpressedchat();
void showwinchat();
void hidewinchat();
main.cpp
// Dark GDK - The Game Creators - www.thegamecreators.com
// the wizard has created a very simple project that uses Dark GDK
// it contains the basic code for a GDK application
// whenever using Dark GDK you must ensure you include the header file
#include "DarkGDK.h"
#include "winpart.h"
// the main entry point for the application is this function
void DarkGDK ( void )
{
initwindowrectchat();
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
double value;
// our main loop
while ( LoopGDK ( ) )
{
showwinchat();
value=dbScanCode();
dbPrint(value);
if(dbKeyState(28)==1)
{
enterpressedchat();
}
// update the screen
dbSync ( );
}
// return back to windows
return;
}
winpart.cpp
#include<iostream>
#include"string"
#include<windows.h>
#include "winpart.h"
#include "winchat.h"
#include <list>
#include<string>
using namespace std;
WNDCLASS wc;
TCHAR lrst[500];
TCHAR lrsttwo[70000];
struct CHARINFO
{
string charname;
int typechar;
};
CHARINFO charinfo;
list <CHARINFO> charinfolist;
list <CHARINFO>::iterator charinfoiter;
//TCHAR lrsttemp[70000];
DWORD dwExStyle;
//DWORD dwExStyle2;
WPARAM wpar;
DWORD dwStyle;
int end=0;
//DWORD dwStyle2;
HDC hdc=NULL;
HGLRC hrc=NULL;
HWND cheakboxs;
HINSTANCE hInstance;
static HWND list2;
HWND MSGbox;
//HWND list22;
HWND okbutton;
// CMENU menucreation;
//HWND okbutton2;
#define CHANGETEXT 1000
#define CHANGEBKG 1001
#define MAX_LOADSTRING 100
#define edit_box_items 1
#define entry_box_item 2
#define button_pressed 3
TCHAR szTitle[MAX_LOADSTRING];
HWND hWnd;
HWND hWnd2;
bool active =TRUE;
string returnstr;
//string returnstr2;
//string returnstr3;
//string returnstr4;
//string returnstr5;
//void hidewin2();
string returnnamecreated()
{
return charinfo.charname;
}
void enterpressedchat()
{
//string temp="";
GetDlgItemText(hWnd,1,lrst,150);
//SetTextColor((HDC)wpar,RGB(250,0,0));
int xcnt=0;
if(lrst[0]!='\0')
{
GetDlgItemText(hWnd,2,lrsttwo,70000);
if(end>=69500)
{
int pcnt=0;
for(int xcnt=1000;lrsttwo[xcnt]!='\0';xcnt++)
{
lrsttwo[pcnt]=lrsttwo[xcnt];
pcnt++;
}
lrsttwo[pcnt]='\0';
end=pcnt;
}
if(end!=0)
{
lrsttwo[end]='\r';
lrsttwo[end+1]='\n';
end++;
end++;
while(lrst[xcnt]!='\0')
{
lrsttwo[end]=lrst[xcnt];
xcnt++;
end++;
}
lrsttwo[end]='\0';
}
else
{
while(lrst[xcnt]!='\0')
{
lrsttwo[end]=lrst[xcnt];
xcnt++;
end++;
}
lrsttwo[end]='\0';
}
//xcnt--;
// lrsttwo=temp.c_str();
SetDlgItemText(hWnd,2,lrsttwo);
}
SetDlgItemText(hWnd,1,"\0");
returnstr=lrsttwo;
//SendMessage(
}
string retstr()
{
return returnstr;
}
WNDPROC wpOrigEditProc;
LRESULT CALLBACK EditSubclassProc(HWND hwnd,UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_GETDLGCODE:
{
if(wParam==VK_RETURN)
{
SetFocus(hWnd);
enterpressedchat();
SetFocus(list2);
}
return(DLGC_WANTALLKEYS|CallWindowProc(wpOrigEditProc,hwnd,uMsg,wParam,lParam));
}
case WM_CHAR:
if(wParam==VK_RETURN)
{
SetFocus(hWnd);
enterpressedchat();
SetFocus(list2);
return 0;
}
else
{
return(CallWindowProc(wpOrigEditProc,hwnd,uMsg,wParam,lParam));
}
case WM_KEYDOWN:
{
if(wParam==VK_RETURN)
{
ShowWindow(hWnd,SW_SHOW);
enterpressedchat();
}
if(wParam==VK_TAB)
{
MessageBox(hwnd,"hi","hi",NULL);
}
break;
}
return(CallWindowProc(wpOrigEditProc,hwnd,uMsg,wParam,lParam));
}
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
LRESULT CALLBACK WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam)
{
wpar=wParam;
static COLORREF customcolors[16];
LPCSTR lpcwstr;
HINSTANCE hInst=(HINSTANCE)GetWindowLong(hWnd,GWL_HINSTANCE);
static LOGBRUSH logbrush;
static TCHAR lpstr[500];
char *newchar=new char[10];
string str="";
int x=0;
int cnt=0;
HWND hwindedit;
int numstr;
switch(uMsg)
{
case WM_CREATE:
MSGbox=CreateWindow(TEXT("EDIT"),"",WS_CHILD|WS_VISIBLE|WS_BORDER|WS_VSCROLL|ES_MULTILINE|ES_READONLY,0,20,195,130,hWnd,(HMENU)entry_box_item,hInst,NULL);
list2=CreateWindow(TEXT("EDIT"), "", WS_CHILD|WS_VISIBLE|WS_BORDER|ES_AUTOHSCROLL|ES_WANTRETURN,0,150,165,20, hWnd, (HMENU)edit_box_items, hInst, NULL);//CreateWindow("listbox",szTitle,WS_CHILD|WS_VISIBLE|LBS_STANDARD,15,15,450,90,hWnd,(HMENU)NULL,hInst,NULL);
okbutton=CreateWindow(TEXT("Button"),"OK",WS_CHILD|WS_VISIBLE,165,150,30,20,hWnd,(HMENU)button_pressed,hInst,NULL);
hwindedit=GetDlgItem(hWnd,edit_box_items);
wpOrigEditProc=(WNDPROC)GetWindowLongPtr(list2,GWLP_WNDPROC);
//SetWindowLong(hwindedit,GWL_WNDPROC,(LONG)EditSubclassProc);
SetFocus(hWnd);
// list22=CreateWindow(TEXT("EDIT"), L"0", WS_CHILD|WS_VISIBLE|WS_BORDER,15,15,100,27, hWnd, (HMENU)3, hInst, NULL);//CreateWindow("listbox",szTitle,WS_CHILD|WS_VISIBLE|LBS_STANDARD,15,15,450,90,hWnd,(HMENU)NULL,hInst,NULL);
//okbutton=CreateWindow(L"Button",L"OK",WS_CHILD|WS_VISIBLE,120,15,30,27,hWnd,(HMENU)2,hInst,NULL);
// okbutton2=CreateWindow(L"Button",L"OK",WS_CHILD|WS_VISIBLE,120,15,30,27,hWnd,(HMENU)4,hInst,NULL);
//SendMessage(list2,LB_ADDSTRING,0,(LPARAM)(LPCTSTR)L"hi there");
//okbuttoniter=CreateWindow(L"Button",L"OK",WS_CHILD|WS_VISIBLE,120,15,30,27,hWnd,(HMENU)3,hInst,NULL);
//SendMessage(list2,LB_ADDSTRING,0,(LPARAM)(LPCTSTR)L"hi there");
break;
case WM_COMMAND:
if(LOWORD(wParam)==3)
{
//SetFocus(hWnd);
enterpressedchat();
//SetFocus(list2);
// GetDlgItemText(MSGbox,2,lrsttwo,70000);
//while(lrst[
//SendMessage(MSGbox,2,"hi there",NULL);
}
if(LOWORD(wParam)==3)
{
// SetFocus(list2);
}
case WM_KEYDOWN: case WM_KEYUP:
{
if(wParam==VK_RETURN)
{
enterpressedchat();
}
}
break;
}
return DefWindowProc(hWnd,uMsg,wParam,lParam);
}
void showwinchat()
{
//ShowWindow(hWnd,SW_HIDE);
ShowWindow(okbutton,SW_SHOW);
ShowWindow(hWnd,SW_SHOW);
//SetLayeredWindowAttributes(hWnd,0,50,LWA_ALPHA);
}
void hidewinchat()
{
ShowWindow(hWnd,SW_HIDE);
}
void initwindowrectchat()
{
LPCSTR winrec="Text Box";
//LPCWSTR winrec2=L"Change two";
hInstance=GetModuleHandle(NULL);
//hInstance2=GetModuleHandle(NULL);
wc.style=CS_HREDRAW|CS_VREDRAW|CS_OWNDC;
wc.lpfnWndProc=(WNDPROC)WndProc;
wc.cbClsExtra=0;
wc.cbWndExtra=0;
wc.hInstance=hInstance;
wc.hIcon=LoadIcon(NULL,IDI_HAND);
wc.hCursor=LoadCursor(NULL,IDC_ARROW);
wc.hbrBackground=(HBRUSH)GetStockObject(LTGRAY_BRUSH);
wc.lpszMenuName="IDC_HEIGHTMAP";
wc.lpszClassName="DarkGDK";
if(!RegisterClass(&wc))
{
MessageBox(NULL,"Failed to Register the window class.","ERROR",MB_OK|MB_ICONEXCLAMATION);
//return false;
}
hWnd=CreateWindowEx(dwExStyle,"DarkGDK",winrec,dwStyle|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_OVERLAPPEDWINDOW,0,0,210,240,NULL,NULL,hInstance,NULL);
hInstance=GetModuleHandle(NULL);
SetLayeredWindowAttributes(hWnd,0,50,LWA_ALPHA);
SetForegroundWindow(hWnd);
//return (int)msg.wParam;
}
targetvar.h
#pragma once
// The following macros define the minimum required platform. The minimum required platform
// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
// your application. The macros work by enabling all features available on platform versions up to and
// including the version specified.
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER // Specifies that the minimum required platform is Windows Vista.
#define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows.
#endif
#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
#endif
#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
#endif
#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0.
#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE.
#endif
a basic window chat box with dark gdk
Go through yourself at a wall.