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
U

User 12105981

@User 12105981
About
Posts
17
Topics
8
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Help with calling .length on an array
    U User 12105981

    Member 12877930 wrote:

    med.length

    l think you are trying to get the size of the ArrayList, you can use

    med.size

    which will give you the size of the list. However, remember that Collection is an interface, thus not supposed to be instantiated. So you can use any of the implementation classes to sort.

    Java java data-structures help

  • Access to Active Directory (Java)
    U User 12105981

    Am new in Java and l have an issue which l urgently need a help. But let me explain in detail so that my question could be understood. First of all, there is a domain and there is also a PC with windows server 2012 which have an Active directory. And through this Active Directory, all other PCs in the domain can be seen. Now, l was given a project which l need to develop a programme that have to access files and folders in each PC seen in the Active Directory. How can l achieve that? Which lib or API do l use. l need any idea to achieve that. l have used the DirContext in JNDI API, still l don't get. l need help in that. Thanks

    Java windows-admin help question java sysadmin

  • C, Win32 API: l need a help with file/data storage
    U User 12105981

    Hi all, Good day. Please am just learning application programming using the Win32 Api. l wrote a small program just like a crackme to save user key in a text file when key is correct and not to ask for the key next time the app is run. But should ask if the file is not found or the contents tampered. But it always ask for key every time the app is run. l had been playing with CreateFile, ReadFile and WriteFile Functions but it doesn't work. l had used OPEN_EXISTING as well as OPEN_ALWAYS in CreateFile function to Create the text file with user key but the app always ask for key even when the data file(.txt) exists. l just need a guideline, proper API or sample code on how to achieve that. My code is a little big and not straight forward for me to put in here. Thanks. ADDENDUM/MODIFICATION @Jeron1, @DavidCrow, @Jochen Arndt Ok. Am confused here, and l don't know if am the one to be confused or the IDE or Microsoft themselves. Am using MS Visual studio 2010 BREAK DOWN. I want it in a way that when the app is started, it should check if the keyfile exists. if exists, read the content and compare it with a keybuffer. if not it should ask for key. code snippet: .....

    WM_CREATE:
    keyFile=(L"C:\\key.txt",GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
    //last error here gives me 0.
    if (keyFile != INVALID_HANDLE_VALUE){
    if (GetLastError() == ERROR_ALREADY_EXISTS){
    // Read file here
    SetFilePointer(keyFile,0,0,FILE_BEGIN);
    ReadFile(keyFile,szKeyRead,11,&dwBytes,NULL);
    if(lstrcmp(szKeyRead,szKeyBuffer)==0){
    //Nothing and continue if key is correct.
    }else{
    DialogBox(hInst,MAKEINTRESOURCE(IDD_REG),hWnd,Reg);//Dialog key if key is not correct

    				}
    			}else if(keyFile == INVALID\_HANDLE\_VALUE || keyFile==NULL|| keyFile==(HANDLE)ERROR\_FILE\_NOT\_FOUND){
    				DialogBox(hInst,MAKEINTRESOURCE(IDD\_REG),hWnd,Reg);//Dialog key if any of the above
    					
        // Ask for key and write file here
    			}else{
    				MessageBox(hWnd,L"Problem with Registration.\\n",L"Registration",0);
    			}
    				 CloseHandle(keyFile);
    						}
    

    Quote:

    Now when l have the code above, the if() statements executes but lands at else if statement whi

    C / C++ / MFC help visual-studio csharp com json

  • C, Win32 API: l need help with ReadFile function[Solved]
    U User 12105981

    Thanks. But l have made necessary corrections but the ReadFile is still not working and GetLasterror still returns 998. Also, direct check of ReadFile also returns 0. Help please.

    Quote:

    hfile=CreateFile("C:\\file.txt",GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL);// this works well

            WriteFile(hfile,szBuffer,256,&in,NULL);//this works well
            SetFilePointer(hfile,0,0,FILE\_BEGIN);
            ReadFile(hfile,szBuf,256,&in,NULL);//this does not read data
            CloseHandle(hfile);
    
                hdc=GetDC(hwnd);
                TextOut(hdc,50,300,szerror,wsprintf(szerror,"%i",GetLastError()));//check return value
                ReleaseDC(hwnd,hdc);
    
    C / C++ / MFC help json question

  • C, Win32 API: l need help with ReadFile function[Solved]
    U User 12105981

    Happy New Month to you all. However, l am playing with Createfile, WriteFile and ReadFile functions, Createfile and Writefile works well but my problem is ReadFile. l want to read the data written to a buffer "szBuffer", by using "ReadFile" to read the data in the szBuffer into another buffer szBuf. But it doesn't work. When l check the return value like error=ReadFile(hfile,szBuffer,10,&in,NULL), it returns 0 but when l use GetLastError() to check for the return value, it gives me 998. l learnt that the second parameter to ReadFile() is the address to store the data read. Code snippet below:

    hfile=CreateFile("C:\\file.txt",GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL);// this works well

    			WriteFile(hfile,szBuffer,256,&in,NULL);//this works well
    			
    		
    			ReadFile(hfile,szBuf,256,&in,NULL);//this does not read data
    			CloseHandle(hfile);
    				
    				hdc=GetDC(hwnd);
    				TextOut(hdc,50,300,szerror,wsprintf(szerror,"%i",GetLastError()));//check return value
    				ReleaseDC(hwnd,hdc);
    

    Can someone help me to overcome this? Thanks.

    C / C++ / MFC help json question

  • C, Win32 API: l need a help
    U User 12105981

    Hi, Good day everyone. l have some difficulties in the following which l need some help. Am a learner in win32 programming. > l created an application with a button "LogOut", which l want, when the user clicks the LogOut button, the application starts afresh. Just like in a standard program(eg. MSWORD) where when "New" is clicked, a new workspace pops out. So l need help in making my program to start afresh when LogOut button is clicked. MY TRIAL: l had done the following, and it worked but it only run the codes in WM_CREATE and l still had sent messages to other cases like WM_PAINT, WM_NOTIFY etc, still only the code in WM_CREATE runs.

    case IDC_LOGOUTBTN:
    SendMessage(hWnd,WM_CREATE, 0,(LPARAM)lpcs)//where lpcs is a pointer to CreateStruct structure.
    break;

    >> At some point in my program, l generate random numbers using srand((unsigned)time(&t)) and rand() functions when NEXT button is clicked. But l want to know if there is anyway to get the previous random number(s) when PREVIOUS button is clicked? Thanks.

    C / C++ / MFC json help question lounge workspace

  • C, Win32 API: painting on a tabcontrol [Solved]
    U User 12105981

    l have gotten a solution. l added the following lines of codes base on msdn WM_SETREDRAW message (Windows)[^]

    SendMessage(hWnd,WM_SETREDRAW,(WPARAM)TRUE,0);
    RedrawWindow(hWnd,NULL,NULL,RDW_ERASE | RDW_FRAME | RDW_INVALIDATE |RDW_UPDATENOW |RDW_NOCHILDREN );

    Thank you all who contributed.

    C / C++ / MFC json

  • C, Win32 API: painting on a tabcontrol [Solved]
    U User 12105981

    Do you have any idea on how l can show the contents of the new tab as am only using TextOut function and not child windows/controls?

    C / C++ / MFC json

  • C, Win32 API: painting on a tabcontrol [Solved]
    U User 12105981

    Screen Shot is at Imgur: The most awesome images on the Internet[^]. It is ownerfixedraw style tab. so l want when Next button is clicked, question 2 will show. But as it is, when next button is clicked, both subsequent questions overlap with the current (Question 1) text. However, the next button is independent, that is, the HWND is not based on the tab control HWND. Thanks.

    C / C++ / MFC json

  • C, Win32 API: painting on a tabcontrol [Solved]
    U User 12105981

    Yes, how l can erase the content(text) in a tab control. Like, when next button is clicked, text content on the display area of the tab clears and another text is displayed. Or moreso, when Next button is clicked, another question shows and so on. Thanks.

    C / C++ / MFC json

  • C, Win32 API: painting on a tabcontrol [Solved]
    U User 12105981

    l want to ask how l can do the following things in a tab control.

    1)That is, for instance: In tab1, when a button is clicked, previous text is wiped and another is written. l had tried but all the texts overlaps and none cleanses off for new texts.

    2)How can l erase the content of a tab control when l switch tabs. As in, when tab2 is clicked, contents in tab1 clears off and the things in tab2 only shows.

    Thanks.

    C / C++ / MFC json

  • C, Win32 API: l need help with tab control [Solved]
    U User 12105981

    @blingg: TC_ITEM is same as TCITEM but according to MSDN, TCITEM supercedes TC_ITEM. However, l have done the corrections, still it doesn't work. l also used SendMessage, still yet no avail. l don't know what's wrong.

    C / C++ / MFC json help tutorial

  • C, Win32 API: l need help with tab control [Solved]
    U User 12105981

    Good day. Please am writing an application, though things are going good. But am stucked in the area where l need to copy the text of what the user selected from a combo box and use that text to initialize the text field of the TC_ITEM struct to show on the tab control. l had tried many tactics. Code snippet below:

    static WCHAR subject1tab[MAX_LOADSTRING]; //max_loadstring =100

    INITCOMMONCONTROLSEX icce = {0};
    TC_ITEM tie={0};
    icce.dwICC=ICC_TAB_CLASSES;
    icce.dwSize=sizeof(INITCOMMONCONTROLSEX);
    InitCommonControlsEx(&icce);

    tie.mask = TCIF_TEXT;
    subjecthwnd=GetDlgItem(hwnd,IDC_UNICALPTUME_SUBJECT1);//I used GetDlgItem to get the handle of the combobox, from whih the text is to be copied from.

    GetWindowText(subjecthwnd,subject1tab,100);//Copy the text of what the user selected from the combobox

    tie.pszText=subject1tab;

    SendMessage(SubjectTabs,TCM_INSERTITEM,(WPARAM)0,(LPARAM)&tie);//add a tab

    So please can someone help me on how to get the text string of selection from a combobox and use it to initialize a tab. Thanks in advance.

    C / C++ / MFC json help tutorial

  • C, Win32: l need help getting user input[Solved]
    U User 12105981

    Thanks.

    C / C++ / MFC help tutorial

  • C, Win32: l need help getting user input[Solved]
    U User 12105981

    TCHAR userName[100];//user input buffer hwndedit=GetDlgItem(hwnd,IDC_UNICALPTUME_SUBJECT_TBOX);//gets edit control's handle userName[100]=(TCHAR) SendMessage(hwndedit,WM_GETTEXT,(WPARAM)sizeof(userName)/sizeof(userName[0]),(LPARAM)userName);//Sent message return (INT_PTR)TRUE; case IDOK://checks if buffer is empty or not when the user clicks OK on the dialog if(userName!=NULL) EndDialog(hwnd,TRUE); return (INT_PTR)TRUE; l also tried GetWindowText(hwnd,userName,sizeof(userName)/sizeof(userName[0])) still it doesn't work. Please can someone me guide me on getting user input and checking if the buffer is empty or not. Thanks everyone.

    C / C++ / MFC help tutorial

  • Win32: l need help on filling a combo box [Solved]
    U User 12105981

    @Jochenn Thanks, l made the corrections and it worked.

    C / C++ / MFC help question learning

  • Win32: l need help on filling a combo box [Solved]
    U User 12105981

    Am creating application and l need to fill a combo box list. However, l was able to do all and is working but whenever l filling the last combobox, l get an exception as below.

    First-chance exception at 0x7789dba9 in Unical PTUME.exe: 0xC0000005: Access violation reading location 0x00000001.
    Unhandled exception at 0x7789dba9 in Unical PTUME.exe: 0xC000041D: An unhandled exception was encountered during a user callback.

    What does it mean and how can l correct it?

    code snippet below:

    case WM_CREATE:
    DialogBox(((LPCREATESTRUCT)lParam)->hInstance, MAKEINTRESOURCE(IDD_CHOICEBOX),hWnd,choicedlg);//Dialog proc.
    return 0;

    INT_PTR CALLBACK choicedlg(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
    int i=0; static int firsttime=1; PWSTR input=NULL;
    switch(message)
    {
    case WM_INITDIALOG:
    //Add faculties to the combo list
    for(i=0; i<=sizeof(Choice)/sizeof(Choice[0]); i++){
    SendDlgItemMessage(hwnd,IDC_UNICALPTUME_FACULTY,CB_ADDSTRING,0,(LPARAM)Choice[i]);
    }
    for(i=0; i<=sizeof(Course)/sizeof(Course[0]); i++){
    SendDlgItemMessage(hwnd,IDC_UNICALPTUME_SUBJECT1,CB_ADDSTRING,0,(LPARAM)Course[i]);
    SendDlgItemMessage(hwnd,IDC_UNICALPTUME_SUBJECT2,CB_ADDSTRING,0,(LPARAM)Course[i]);
    SendDlgItemMessage(hwnd,IDC_UNICALPTUME_SUBJECT3,CB_ADDSTRING,0,(LPARAM)Course[i]);
    SendDlgItemMessage(hwnd,IDC_UNICALPTUME_SUBJECT4,CB_ADDSTRING,0,(LPARAM)Course[i]);
    SendDlgItemMessage(hwnd,IDC_UNICALPTUME_SUBJECT5,CB_ADDSTRING,0,(LPARAM)Course[i]);
    SendDlgItemMessage(hwnd,IDC_UNICALPTUME_SUBJECT6,CB_ADDSTRING,0,(LPARAM)Course[i]);
    }
    for(i=0; i<=sizeof(Year)/sizeof(Year[0]); i++){
    SendDlgItemMessage(hwnd,IDC_UNICALPTUME_YEAR1,CB_ADDSTRING,0,(LPARAM)Year[i]);
    SendDlgItemMessage(hwnd,IDC_UNICALPTUME_YEAR2,CB_ADDSTRING,0,(LPARAM)Year[i]);
    SendDlgItemMessage(hwnd,IDC_UNICALPTUME_YEAR3,CB_ADDSTRING,0,(LPARAM)Year[i]);
    SendDlgItemMessage(hwnd,IDC_UNICALPTUME_YEAR4,CB_ADDSTRING,0,(LPARAM)Year[i]);
    SendDlgItemMessage(hwnd,IDC_UNICALPTUME_YEAR5,CB_ADDSTRING,0,(LPARAM)Year[i]);
    SendDlgItemMessage(hwnd,IDC_UNICALPTUME_YEAR6,CB_ADDSTRING,0,(LPARAM)Year[i]);
    } //etc
    However, if l add the code below, l always get error message as above.

    for(i=0; i<=sizeof(Time)/sizeof(Time[0]); i++){
    SendDlgItemMessage(hwnd,IDC_UNICALPTUME_TIME,CB_ADDSTRING,0,(LPARAM)Time[i]);
    }// problem code

    C / C++ / MFC help question learning
  • Login

  • Don't have an account? Register

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