Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
P

Polite Programmer

@Polite Programmer
About
Posts
39
Topics
19
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Which Job is better?
    P Polite Programmer

    Well, Lets go to the benefits: The Microsoft Oriented Firm is far away the other one is quit near The Microsoft Oriented Firm has promised to increment 5,000 PKR after six months while the Open Source is promising the same after 3 months and again 5,000 PKR in next 3 months. Microsoft Oriented firm gives health insurance the other firm does not Microsoft Oriented firm gives 2 months salary as a bonus every year, while other does not. Well, one of the guy pointed out why I am asking these questions when even i don't know... So the answer is that we, the developers are a separate community tied in a different sort of brotherhood. Many of you will be far more experienced and visionary about the things then I am...

    Polite Programmer


    More Object Oriented then C#

    The Lounge csharp question career c++ java

  • My monitor has some physics
    P Polite Programmer

    Either border is mis adjusted....

    Polite Programmer


    More Object Oriented then C#

    The Lounge com game-dev help

  • Which Job is better?
    P Polite Programmer

    Well, anyone visited the URLs given?

    Polite Programmer


    More Object Oriented then C#

    The Lounge csharp question career c++ java

  • Which Job is better?
    P Polite Programmer

    Yes I am quit young... 22 years old...

    Polite Programmer


    More Object Oriented then C#

    The Lounge csharp question career c++ java

  • Which Job is better?
    P Polite Programmer

    I think the larger one has more chances to survive for long....

    Polite Programmer


    More Object Oriented then C#

    The Lounge csharp question career c++ java

  • Which Job is better?
    P Polite Programmer

    I am very sorry if the question disturbts you but I seek for the advice of you geeks... Well here it goes: I am being offered by two software companies. One is working on Open Source Solution in various technologies ranging from Java, Python, C/C++ etc. The revenues come from the projects that the company takes from its clients. The company itself is quite small and with a team of 10 developers. Here is the URL: http://www.zeropoint.it The other company works on .NET Solutions. The revenues are generated by the two products named NCache and TierDeveloper. The staff is 40+ and has proper quality assurance and other departments. Here is the URL http://www.alachisoft.com Both are offering same salary... Which one should I select? I am very much confused... the confusion is that the first company works on many technologies and this way I would have change to work on diverse areas thus will have strong technical skills. As for the second company, I feel I will be only usefull for the .NET solutions.... What do you suggest me guys? Regards,

    Polite Programmer


    More Object Oriented then C#

    The Lounge csharp question career c++ java

  • Windows Blinds...
    P Polite Programmer

    You might have seen the utility named Windows Blinds that skins the entire windows enviroment. I am wondering how they do that? any idea? do the subclass every global control class? or what?

    Polite Programmer


    More Object Oriented then C#

    C / C++ / MFC csharp tools oop question

  • Unicode Characcters in Query.
    P Polite Programmer

    I am developing a solution in C# on top of ADO.NET. I am using MS Access as my data store. My requirement is that i have to insert a Unicode string containing Arabic characters into the database. So following is the INSERT command INSERT INTO ClauseTranslations (Translation) VALUES('اردو کی ایک مثال') So thats it. Now this query executes very well in the MS Access environment but simply fails when executed from the C# application using the ADO.NET classes. The error message is "Syntax Error in INSERT Statement" Can anyone guide me whats wrong and where is it wrong? Regards, Mohsin

    Polite Programmer


    More Object Oriented then C#

    Database csharp database oop help tutorial

  • Heap corruption.
    P Polite Programmer

    Ooooooopsssss! Sorry for that much long message....

    Polite Programmer


    More Object Oriented then C#

    C / C++ / MFC help csharp debugging oop question

  • Heap corruption.
    P Polite Programmer

    Reason for using malloc() stuff is that I want to be pure in C. What I am doing? 1.... I want to write a pure C control to teach myself internals of Win32 Message Architecture. 2... When done with this, I will burry that control (a simple button control yet...) into a DLL. 3... When done with the DLL, I will try to write a COM wrapper around it that too in pure C to check whether it can be used with VB, and .NET. Friends one more thing... my every malloc() is having a free() but still facing problem. And one of our felllows is very much right, the problem only occurs in Debug sessions. Here is the source code. Please consider the following functions specially.... Are they correct? a) AllocateButtonInfoFor() b) DeleteButtonInfo() c) OnNCCreate() d) OnSetText() First is the ButtonControl.h ============================ #ifndef __BUTTON_CONTROL_H__ #define __BUTTON_CONTROL_H__ #include "stdafx.h" #define BUTTON_CONTROL_CLASS TEXT("BUTTON_CONTROL_safsf") #ifdef __INCLUDE_BUTTONCONTROL_PRIVATES__ /* Depicts the state of the button */ typedef enum tagBUTTONSTATE { NORMAL = 2, HOVER, PRESSED, DISABLED } BUTTONSTATE; /* Structure to hold the information of the button*/ typedef struct tagBUTTONINFO { // HWND hWnd; /* Handle of the button itself */ TCHAR * szText; /* The caption of button */ int nTextLength; /* Length of caption */ HPEN borderColor; /* The outline color */ COLORREF textColor; /* The Text Color of the button */ HBRUSH backColor; /* The background color of the button */ HFONT font; /* The font of the text */ HPEN borderColorPressed; /* The border color in pressed form*/ COLORREF textColorPressed; /* The text color in pressed form */ HBRUSH backColorPressed; /* The back color in pressed form */ HFONT fontPressed; /* The font in pressed form */ HPEN borderColorHover; /* The border color in hover form*/ COLORREF textColorHover; /* The text color in hover form */ HBRUSH backColorHover; /* The back color in hover form */ HFONT fontHover; /* The font in hover form */ BUTTONSTATE state; /* The state of the button */ } BUTTONINFO, * PBUTTONINFO; /* ButtonInfo Allocation */ //HANDLE CreateHeapIfNeeded(); //BOOL DestroyHeapIfNeeded(HANDLE); PBUTTONINFO AllocateButtonInfoFor(HWND hWnd); PBUTTONINFO PickButtonInfo(HWND hWnd); BOOL DropButtonInfo(HWND hWnd); void DeleteButtonInfo(HWND hWnd); void SetButtonDefaults(HWND hWnd, PBUTTONINFO pButtonInfo)

    C / C++ / MFC help csharp debugging oop question

  • Heap corruption.
    P Polite Programmer

    One more thing, The GlobalAlloc() and GlobalFree() also act the similar way as the malloc() does.

    Polite Programmer


    More Object Oriented then C#

    C / C++ / MFC help csharp debugging oop question

  • Heap corruption.
    P Polite Programmer

    But the constructor is not needed to dot that because after executing the malloc(), I immediatly call ZeroMemory like this. PBUTTONINFO pButtonInfo = (PBUTTONINFO) malloc (sizeof (BUTTONINFO)); ZeroMemory ((LPVOID) pButtonInfo, sizeof (BUTTONINFO));

    Polite Programmer


    More Object Oriented then C#

    C / C++ / MFC help csharp debugging oop question

  • Heap corruption.
    P Polite Programmer

    I am writting a button control from scratch in pure C + Win32. I have a structure as under typedef struct tagBUTTONINFO { TCHAR * szText; int iLenght; COLORREF backColor // Other memebers... } BUTTONINFO, * PBUTTONINFO; Now on each WM_NCCREATE, I use malloc() to allocate a BUTTONINFO and set its address in USERDATA of the HWND of the window. In each WM_SETTEXT, I allocate space for the text and set in the PBUTTONINFO->szText. On WM_NCDESTROY, I deallocate the space for BUTTONINFO and the BUTTONINFO::szText as well. But in debug sessions, I get Heap Corruption Error Message. Whats wrong? However, if you use new and delete keywords for the same tasks, no such problem occurs... whats wrong and where?

    Polite Programmer


    More Object Oriented then C#

    C / C++ / MFC help csharp debugging oop question

  • Escape Sequences....
    P Polite Programmer

    Hello! I am developing a .NET 2.0 solution (C#) using ADO.NET I have a question regarding the escape sequences in SQL. Consider the following query SELECT * FROM ClauseTranslations WHERE Clause LIKE 'trainee's cost' Now when executed, this query generates an exception. Very well. The problem with with the single quote symbol. so what I do, I write like this: SELECT * FROM ClauseTranslations WHERE Clause LIKE 'trainee\'s cost' But this still gives error... What the way out? Regards, Mohsin

    Polite Programmer


    More Object Oriented then C#

    Database csharp database help question oop

  • The Learning Paradigm...
    P Polite Programmer

    I wonder whats the paradigm of learning... Let me clear what I am saying... What our learning process is: 1... Get a very minimal architectural view of a technology (suppose .NET) 2... Jump in and Code! Where stuck, consult documentation and then back to keyboard! Here we slove the problems on fly. We solve and understand them as we encounter them. For instance, I want to have a small menu to appear under a specific word. That needs to customize the rich text box. Now Whats the correct way? Complete a books or two on the topic then start working on learn as you go along? Which one of is the approach of the professionals? Regards.

    Polite Programmer


    More Object Oriented then C#

    C / C++ / MFC csharp oop help question learning

  • Almost a year...
    P Polite Programmer

    Well, why not Charlz... Moreover, I'm using VC.NET 2003. Any further advice?

    Polite Programmer


    More Object Oriented then C#

    The Lounge csharp c++ oop question learning

  • Memory Allocation
    P Polite Programmer

    I'm sure it does'nt write past iLen * 7 but I'm not sure whether it can corrupt the stack. Please tell me how code can corrupt the stack? (Becuase I really dont know if the question seem stupid)

    Polite Programmer


    More Object Oriented then C#

    C / C++ / MFC csharp oop performance help question

  • Memory Allocation
    P Polite Programmer

    Here is the full code, Comments starting with NOTE are the erroroneous... #include #include #include #include "resource.h" #include "convert.h" HWND hwndNextClipboardVierwer ; char * szInPageData ; HFONT hFont ; // Processes the conversion /* void ProcessConversion(HWND hDlg) { TCHAR * pInPageText = NULL ; TCHAR * pUnicodeText = NULL ; HWND hwndInPageText = GetDlgItem(hDlg, IDC_EDIT_INPAGE) ; HWND hwndUnicodeText = GetDlgItem(hDlg, IDC_EDIT_UNICODE) ; int iLen = GetWindowTextLength(hwndInPageText) ; if(iLen <=0) return ; pInPageText = new TCHAR[iLen + 1] ; GetWindowText(hwndInPageText, pInPageText, iLen) ; pUnicodeText = ConvertInPageToUncode(pInPageText, iLen) ; SetWindowText(hwndUnicodeText, pUnicodeText) ; if(pInPageText != NULL)delete []pInPageText ; if(pUnicodeText != NULL) delete []pUnicodeText ; } */ void DumpHex(TCHAR * szText, HWND hDlg) { int iLen = _tcsclen(szText) ; TCHAR szBuffer[10] ; /*NOTE: This call fails i.e. returns NULL (even iLen is > 0)*/ TCHAR * szHexDump = new TCHAR[iLen * 7] ; ZeroMemory(szHexDump, iLen * 7) ; for(int i = 0 ; i < iLen ; i++) { wsprintf(szBuffer, _T("0x%X, "), szText[i]) ; _tcscat(szHexDump, szBuffer) ; } SetDlgItemText(hDlg, IDC_EDIT_UNIHEX, szHexDump) ; /*NOTE: This Call generates Heap corruption message from CRT*/ delete [] szHexDump ; } BOOL CALLBACK DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { HANDLE hMemory = NULL; TCHAR * szUnicodeText = NULL ; char * lptstr = NULL ; int iLen = NULL ; switch(msg) { case WM_INITDIALOG: hwndNextClipboardVierwer = SetClipboardViewer(hWnd) ; hFont = CreateFont( 80, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _T("Pak Nastaleeq")) ; SendDlgItemMessage(hWnd, IDC_EDIT_UNICODE, WM_SETFONT, (WPARAM) hFont, TRUE) ; return FALSE ; // Handle the change of the clipboard. case WM_DRAWCLIPBOARD: if(OpenClipboard(hWnd)) { hMemory = GetClipboardData(CF_TEXT) ; lptstr = (char *) GlobalLock(hMemory) ; if(hMemory == NULL || lptstr == NULL) { CloseClipboard() ; return FALSE ; } iLen = strlen(lptstr) ; szInPageData = new char[iLen + 1] ; szUnicodeText = new TCHAR[(iLen / 2) + (iLen / 100) * 10] ; strcpy(szInPageData, lptstr) ; GlobalUnlock(hMemory) ; SendMessage(hwndNextClipboardVierwe

    C / C++ / MFC csharp oop performance help question

  • Almost a year...
    P Polite Programmer

    Its more than a year that I'm trying to learn programming windows both ways, SDK and MFC but I still find myself very much infant... Though I admit I have'nt actively coded much becuase I have to pursue my studies but its quite furstrating... It seems to me I can never never be a proficient windows programmer like Jerry Ritcher, Jeff Prosie or Paul... My style goes like this... Suppose I'm working on clipboard. I will open up MSDN read the relevant sections and take appropiate notes out of it. Then will try to build something minimal but working. Will be modifying it until it works the way I want it to be... meanwhile, MSDN lies besides me and I find myself consulting every now and then. Even I forget what parameters WM_SETFONT message takes.... Again I've to resort to MSDN for it. What's wrong where's wrong? You learning process was similar?

    Polite Programmer


    More Object Oriented then C#

    The Lounge csharp c++ oop question learning

  • Memory Allocation
    P Polite Programmer

    You are right, not enough information: Value of iLen is > 0 < 200. Moreover, between the lines, we are just calling string manipulation functions like strlen, strcpy etc. But when the delete []szText is executed, heap corruption message follows....

    Polite Programmer


    More Object Oriented then C#

    C / C++ / MFC csharp oop performance help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups