http://bugs.winehq.org/show_bug.cgi?id=13355
--- Comment #12 from Alikas nx@operamail.com 2008-10-29 12:18:12 --- Created an attachment (id=16968) --> (http://bugs.winehq.org/attachment.cgi?id=16968) govorenie.exe source code
This code create richedit control, who not good work on Wine, but good work on Windows XP:
LoadLibrary("Riched32.dll"); ///* LoadLibrary(TEXT("Msftedit.dll")); //*/ hwndEdit= CreateWindowExW(0, L"RICHEDIT50W",NULL, ES_MULTILINE |ES_NOHIDESEL| WS_VISIBLE | WS_CHILD | WS_TABSTOP| WS_VSCROLL, 0, 0, 0, 0, hwnd, NULL, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL);
This code open file and copy this file content to hwndEdit window:
if((HWND)lParam ==op) { OPENFILENAME ofn; char szFile[260]; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hwnd; ofn.lpstrFile = szFile; ofn.lpstrFile[0] = '\0'; ofn.nMaxFile = sizeof(szFile); ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0"; ofn.nFilterIndex = 1; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; if (GetOpenFileName(&ofn)==TRUE) { hFile = CreateFileA(ofn.lpstrFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0); if(hFile != INVALID_HANDLE_VALUE) { DWORD dwFileSize; dwFileSize = GetFileSize(hFile, NULL); if(dwFileSize != 0) {tk = (LPSTR)GlobalAlloc(GPTR, dwFileSize + 1); DWORD dwRead; ReadFile(hFile,tk, dwFileSize, &dwRead, NULL); wtk=new WCHAR[dwFileSize + 1];
MultiByteToWideChar(1251,0,tk,-1,wtk,dwFileSize + 1);
SetWindowTextW(hwndEdit,wtk); SendMessage(hwndEdit,EM_SETMODIFY,true,0); GlobalFree(tk);delete[] wtk; } } CloseHandle(hFile); SetCurrentDirectory(bdir); } }