Hello I have a RichEdit and a multiline edit in my app. What is the simplest and easiest way to change word-wrap of the edit controls during run-time of app? Thanks in advance.
insanely420
Posts
-
Word wrap in Rich Edit and multiline edit -
Invoking Task Scheduler Wizard through APIGreetings I have a command line tool and I want to provide a GUI interface to schedule the tool to perform its job. Now the problem is how do you I invoke the Query Interface wizard thru API? I can create a test sample job using the following code but I am unable to start the wizard so that the user can set it times directly thru my app. Thanks in advance. ITaskScheduler * sITS; HRESULT InitTSAPI() { HRESULT hr = S_OK; _ASSERTE ( SUCCEEDED(CoInitialize(NULL)) ); // init COM if (SUCCEEDED(hr)) { hr = CoCreateInstance(CLSID_CTaskScheduler, NULL, CLSCTX_INPROC_SERVER, IID_ITaskScheduler, (void **) &sITS); if (FAILED(hr)) { return hr; CoUninitialize(); } } return hr; } HRESULT CreateTask ( WCHAR * pTaskName ) { HRESULT hr = S_OK; ITask * task = 0; IPersistFile * pFile = 0; hr = sITS->NewWorkItem( pTaskName, CLSID_CTask, IID_ITask, (IUnknown**)&task ); if ( FAILED ( hr )) return hr; hr = task->QueryInterface(IID_IPersistFile, (void **)&pFile); task->Release(); hr = pFile->Save ( NULL, TRUE); _ASSERTE ( SUCCEEDED ( hr )); pFile->Release(); return S_OK; } void main() { InitTSAPI(); CreateTask(L"Test Task"); sITS->Release(); }
-
Modal dialog removes my App from Alt+Tab windows...Well....the app is there if I switch between apps 1-2 times...then its GONE!!!!
-
Modal dialog removes my App from Alt+Tab windows...Well...I tried changing the parent window but its not working. It seems that whenever I am doing Alt+Tab, both the dialog window and the main app window loses focus and perhaps that is causing the problem.....
-
Modal dialog removes my App from Alt+Tab windows...I am using Win32 API's. You mean to say that instead of sending the MDI Child Window as Parent for the dialog I send the Main App Window handle as the parent.
-
Rich edit vertical scroll bar not workingGreetings I have a Rich Edit control for my app which I am using to Syntax Colorize SQL language whenever one SQL is opened in the editor. On every EN_CHANGE, i am lexing the SQL and colorizing it accordingly. The code I am using are - code: ----------------------------------------------------------------------------- if ( HIWORD ( pWPARAM ) == EN_VSCROLL ) { if ( pCQueryWnd->pCQueryEdit->uHiliting ) return 0; PostMessage ( pCQueryWnd->pCQueryEdit-uHWND, UM_CONTENT_CHANGE, 0, 0 ); } ----------------------------------------------------------------------------- This is written in its Parent Window WndProc. In the WM_VSCROLL message of the window I am having the following code snippet - code: ------------------------------------------------------------------------ case WM_VSCROLL: if ( !pCQueryEdit->uHiliting ) PostMessage ( pCQueryEdit->uHWND, UM_CONTENT_CHANGE, 0, 0 ); break; ----------------------------------------------------------------------------- I need to process VScrolling as I am doing only screenfull of highlighting for optimizations. Therefore whenever a user is pressing the Scroll button I am again Lexing screenful of text and colorizing it. Before highlighting I am using the following functions code: ----------------------------------------------------------------------------- pDoc->Undo( tomSuspend, NULL ); // dont record this into the undo stack pDoc->Freeze(&f); ----------------------------------------------------------------------------- After highlighting I am using code: ----------------------------------------------------------------------------- pDoc->Unfreeze(&f); pDoc->Undo( tomResume, NULL ); ----------------------------------------------------------------------------- In between I am highlighting part of text using the following method code:------------------------------------------------------------------------ ITextRange * textrange; ITextFont * font; pDoc->Range ( pStart, pEnd, &textrange ); textrange->GetFont ( &font ); font->SetForeColor( pColor ); font->Release(); textrange->Release(); ----------------------------------------------------------------------------- The problem is that VScroll does not work properly. IF I stop colorizing everything starts working. If I use the Mousewheel everything is working perfectly Note : This problem only happens when the screen is in the first line. I cant seem to scroll the first line up the
-
Modal dialog removes my App from Alt+Tab windows...I have a MDI application whenever I am opening a modal dialog box which is a child of a MDI window, my application seems to be lost from the Alt+Tab program list of Windows? I am using WinAPI and DialogBoxParam() function to create the dialog. Why is it happening? Any ideas how to resolve it.
-
Problem with SQLColumns in ODBC APISQL_C_DOUBLE is defined as 8. So I used SQLDOUBLE decimaldigit; SQLBindCOl ( hstmt, 9, SQL_C_DOUBLE, &decimaldigit, 0, &decsize ); For the double column the decimaldigit value is 0.000000000 and decsize it is -1. I am confused. Even the MSDN docs tell me to use the function this way :confused:
-
Problem with SQLColumns in ODBC APIGreetings I am writing an app to import data from an Access DB. I am fetching the information about columns of a table by using the following method - SQLCHAR colname[SIZE_128+1]={0}; SQLINTEGER colsize=0; SQLSMALLINT decimaldigit=0; // allocate. VERIFY ( (retcode = SQLAllocHandle ( SQL_HANDLE_STMT, sqlhdbc, &hstmt )) == SQL_SUCCESS ); retcode = SQLColumns ( hstmt, NULL, 0, NULL, 0, (SQLCHAR*)szTable, SQL_NTS, NULL, 0 ); if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO) { /* Bind columns in result set to buffers */ SQLBindCol(hstmt, 4, SQL_C_CHAR, colname, SIZE_128, &size ); SQLBindCol(hstmt, 7, SQL_C_SLONG, &colsize, 0, &size ); SQLBindCol(hstmt, 9, SQL_C_SSHORT, &decimaldigit, 0, &decsize ); } while( TRUE ) { retcode = SQLFetch(hstmt); if ( retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO ) { // do stuff } else { break; } } Now the problem is that even if a column is defined as DOUBLE in Access and has data like 2.345, 3.001, 0.0001 etc. The decimaldigit is always returned with value 0. Therefore I am not able to get the correct decimal point for the column. So instead of getting colsize = 15 and decimaldigit = 2, I am always getting colsize = 15 and decimaldigit = 0? Am I doing something wrong? Thanks in advance. Karam
-
Focus In Dialog BoxThanks...... It works
-
Focus In Dialog BoxGreetings... In a dialog box I am creating one cutsom drawn grid, now when the user presses TAB in the dialog box, the focus is changed to all other control except the Grid ? I belive since I am creating Grid in the WM_INITDIALOG message of the dialog box the tab is not making focus move to the GRID ? How do I make the focus move to the grid ? Thanks Ritesh
-
Showing last page in RichEditGreetings... I have 3 edit boxes which are children of a tab control. The tab has 3 tab items with each edit window for its respective work. Now when the user changes the tab how I make sure that the last page of edit box is always seen ? I am getting the TCN_SELCHANGING message and am able to trap it but how to show the last page of text fully viewable in the editbox ? Thanks in advance. Ritesh
-
Shortcut making .ini behaving abnormallyThanks. What is the best method to know the directory in which .EXE is being executed ? Ritesh
-
Caret not positioned in RicheditGreetings... I am using the following code to paste data in the Rich Edit control in my application. HGLOBAL hglb; LPTSTR lptstr; if (!OpenClipboard(this->uHWND)) return; hglb = GetClipboardData(CF_TEXT); if (hglb != NULL) { lptstr = (char*)GlobalLock(hglb); if (lptstr != NULL) { SendMessage ( this->uHWND, EM_REPLACESEL, TRUE, (LPARAM)lptstr ); GlobalUnlock(hglb); } } CloseClipboard(); return; } Now the problem is that sometimes the caret of the edit box is not positioned where it should be ? After pasting the caret moves to 2-3 characters before the end, but when I start typing or do any editing then work is done from the end as expected. So why the caret is not being viewed at the proper place when I paste the data ? Any help will be appreciated. Thanks. Ritesh
-
Shortcut making .ini behaving abnormallyGreetings... My application createas .ini file to store some data. I have installer which creates a shortcuts to the .exe the Program Files directory and creates two icons in the start menu and in the desktop. When I run the application through the desktop shortcut, the .ini file is getting created in the Program Files directory which is what I expect. But when I run the application from the Start menu shortcut, the .ini is getting created in the Start Menu diorectory which is causing the .ini file to be also shown in the Start Menu, which I dont want. In my application I am using the following method which I belive is wrong - CreateFile ( "Application.ini", ........ ); How can I make sure that the ini is created in the directory of the program and not anywhere ? Thanks in advance. Rgds Ritesh
-
WM_LBUTTONDBLCLK not coming ?Well...CSDBLCLICKS in my wndclass during RegisterWindowEx solved the problem. Thannks for the suggestion Ritesh
-
WM_LBUTTONDBLCLK not coming ?Greetings... I have a custom drawn window in a dialog box. In the window procedure I am not able to trap WM_LBUTTONDBLCLK, the message is not coming only. I am getting WM_ONLBUTTONDOWN ? Any suggestions on how to get WM_LBUTTONDBLCLK. Thanks in advance. Ritesh
-
Word in C++Thanks...I will take a look at it. Ritesh
-
Word in C++Greetings I have been able to automate Word using my application. I have been able to write three lines of text into it. Now how should I create tables and format text in it. Now how should I add tables for formatting. Ritesh Below is the code which i am using ============================================================================= #include #include int main(int argc, char* argv[]) { // ******************* Declare Some Variables ******************** // Variables that will be used and re-used in our calls DISPPARAMS dpNoArgs = {NULL, NULL, 0, 0}; VARIANT vResult; OLECHAR FAR* szFunction; BSTR bstrTemp; // IDispatch pointers for Word's objects IDispatch* pDispDocs; //Documents collection IDispatch* pDispSel; //Selection object IDispatch* pDispActiveDoc; //ActiveDocument object // DISPID's DISPID dispid_Docs; //Documents property of Application object DISPID dispid_DocsAdd; //Add method of Documents collection //object DISPID dispid_Sel; //Selection property of Applicaiton object DISPID dispid_TypeText; //TypeText method of Selection object DISPID dispid_TypePara; //TypeParagraph method of Selection object DISPID dispid_ActiveDoc; //ActiveDocument property of Application //obj DISPID dispid_SaveAs; //SaveAs method of the Document object DISPID dispid_Quit; //Quit method of the Application object // ******************** Start Automation *********************** //Initialize the COM libraries ::CoInitialize(NULL); // Create an instance of the Word application and obtain the pointer // to the application's IDispatch interface. CLSID clsid; CLSIDFromProgID(L"Word.Application", &clsid); IUnknown* pUnk; HRESULT hr = ::CoCreateInstance( clsid, NULL, CLSCTX_SERVER, IID_IUnknown, (void**) &pUnk); IDispatch* pDispApp; hr = pUnk->QueryInterface(IID_IDispatch, (void**)&pDispApp); // Get IDispatch* for the Documents collection object szFunction = OLESTR("Documents"); hr = pDispApp->GetIDsOfNames (IID_NULL, &szFunction, 1, LOCALE_USER_DEFAULT, &dispid_Docs); hr = pDispApp->Invoke (dispid_Docs, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, &dpNoArgs, &vResult,
-
Excel Like TabGreetings... I want a have Excel like flat tab in my application at the bottom of my tab control. Can somebody suggest me a way or any article on net which tells me how to go through it. I am not using MFC, only Win32 APIs Thanks in advance. Ritesh