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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
W

Wenrich

@Wenrich
About
Posts
22
Topics
17
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Address passing between two processes
    W Wenrich

    It's not home work, not an assignment. i just want to find out how exactly an AV exception is raised. This question is such one that confused me. Please focus on what would happen under this situation rather than how to do the "passing". Thank you!

    C / C++ / MFC question

  • Address passing between two processes
    W Wenrich

    Imagine the following situation: I pass the address of an integer varialbe of process A to process B, and have process B to write a value to this address. 1> would an Access Violation exception be DEFINITELY raised? 2> if process B happens to have a non-constant variable (i.e. writable) locating at the same address as the one passed to it, would an AV exception be raised? if not, does that mean process B would simply change its own variable value? Thanks a lot! Wenrich

    C / C++ / MFC question

  • Process's virtual address
    W Wenrich

    Thanks a lot! I'm aware of the virtual memory and physical memory concepts. I just got confused by the statement that process A and process B both have acess to virtual memory at 0x12345678, because my understanding is that the system uses the virtual memory space allocated to the process to verify whether a memory access is valid and an Access Violation would be raised if it's not. Is my understanding wrong? Thank you very much for your help! Wenrich

    C / C++ / MFC question performance

  • Why my SQL Server is so slow?
    W Wenrich

    I just installed SQL Server on my machine, and found that it was really slow! I even had to wait for quite a while when create a table or open an empty table in the Enterrpise Manager. Accessing it from a program is also painfully slow. I got SQL Server SP2 installed as well, but didn't solve the problem. Any ideas? Thanks a lot! Wenrich

    Database database sql-server sysadmin help question

  • Different versions of ODBC drivers accept different parameters (Execute())??
    W Wenrich

    Thanks Varel! this query is CString query; query.Format(_T("SELECT * FROM %s WHERE (%s='%s') AND (%s='%s')"), table, key, value1, field, value2); // table:"client", key:"ID", value1:"some name", field:"Pass", values"some // password" Is there anything wrong with the field names? Thanks a lot!

    C / C++ / MFC database help question announcement

  • Different versions of ODBC drivers accept different parameters (Execute())??
    W Wenrich

    in my app, i have the following code run successfully with MS Access Driver 4.00.6019.00, but fail with version 4.00.6200.00. the exception thrown says "[ODBC MS Access Driver] Too few parameters. Expected 1." // _ConnectionPtr m_pConnection; // _RecordsetPtr m_pRecordSet; m_pRecordSet = m_pConnection->Execute(_bstr_t(query), &vRecsAffected, adOptionUnspecified); How should i overcome this problem? is there a generic way that works with different versions of MS Access Driver? Thanks a lot! Wenrich

    C / C++ / MFC database help question announcement

  • Building MFC extension problem
    W Wenrich

    I've finished a socket application and am trying to build the core part of the application into a DLL. the "core part" includes CMySocket class derived from CAsyncSocket, and some other helper classes. CMySocket stores a pointer to a CMainFrame object, which has proper functions that handle events occuring on the socket. The main purpose of writing this DLL is to make the CMySocket class easy to be reused for future applications. I want to define the handler function prototypes that the future applications would follow. I don't want to restrict the pointer to a CMainFrame object, rather it can be pointing to any CWnd-like object, which would allow more flexibility. My question is: since CMySocket needs a pointer to a CWnd to call proper handlers when events occuer, how can I get rid of the implementation of the functions and hence the CWnd-like class? (I don't think deriving a class from CWnd is a good idea; if so, that means the applications need to derived another new class from that one. Is it?) This is the first i ever try to build a DLL. Any hint is strongely welcome. (btw, the DLL would be an MFC extention DLL) Thank you so much! Wenrich

    C / C++ / MFC question c++ asp-net help

  • How to detect network connection?
    W Wenrich

    Hi! How to detect whether the network connection is available for a machine running Win2K? What is the API i can use? Thanks a lot!

    C / C++ / MFC question sysadmin json tutorial

  • Why connect() fails in the worker thread but succeeds in the main thread?
    W Wenrich

    In my MFC application running on Win2k, the following code fails in a worker thread, but succeeds in the main thread. \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ servaddr.sin_family = AF_INET; servaddr.sin_port = htons(PORT); servaddr.sin_addr.S_addr = IP; int ret = connect(sockfd, (struct sockaddr *) &servaddr, sizeof(servaddr)); \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ In the worker thread, the error is always WSAETIMEDOUT, never succeeds! But the same code in an applicaiton running on WinCE works well! What's wrong with it? Thanks a lot!

    C / C++ / MFC c++ help question

  • How to display a tip when the cursor moves into a pane ?
    W Wenrich

    How to display a tip, like the tooltips, when the cursor moves into a pane of a spliiter window? Thanks a lot! Wenrich

    C / C++ / MFC tutorial question

  • How to set the background color of one line of CListCtrl?
    W Wenrich

    My ClistCtrl is of LVS_REPORT style, i want to set the background color of alternative lines(NOT the whole control). How? Thanks a lot!

    C / C++ / MFC tutorial question

  • Dial-up Connection and CAysncSocket PROBLEMS!
    W Wenrich

    in my PocketPC2002 app, I create a CAysncSocket object to send a file to the server. The PocketPC uses diap-up connection to the Internet. I got some problems: Case 1> I don't specify the operating mode of the socket. while the sending is is progress, if the dial-up connection is disconnected, the mySock.Send() does NOT return! so my program hangs! Seems like CAsyncSocket operates in blocking mode, but the documentation says the default mode is non-blocking! Case 2> I specify the operating mode like following: unsigned long mode = 1; ioctlsocket(mySock.m_hSocket, FIONBIO, &mode); // explicitely set it to non-blocking mode then, after a few KBs of data are sent, i get two WSAEWOULDBLOCK errors and then mySock.Send() always returns 0. The whole file can NOT be sent. While in the first case, the whole file can be sent successfully if the network is available throughout the transfer. I'm very confused and frustrated as well! Please HELP! Thanks a million! Wenrich

    C / C++ / MFC sysadmin help

  • Why gethostbyaddr() doesn't work for dial-up client?
    W Wenrich

    In order to know whether a dial-up client is still connected to the server, i use gethostbyaddr() passed with client's IP (which is dynamic)in the server program to check (this is for the case that the client closes(or drops accidentally) the dial-up connection without closing the socket connection in advance; if client closes the socket connection, the server is able to know that). But i get error with code 11004, which i believe is something about dababase. My question is: can i use gethostbyaddr() in the server program to check client's abnormal disconnetion? if so, what's wrong with my method? if not, what would be the proper way? Thanks a lot! Wenrich

    C / C++ / MFC question sysadmin help

  • Is pipe an effiecient way for communication between threads?
    W Wenrich

    is it fast, reliable? What are the cases it is must suitable for and what are the cases it shouldn't be used? Thanks a lot! Wenrich

    C / C++ / MFC question

  • EnableMenuItem() does not make menu item gray???
    W Wenrich

    Hi! I come across a strange thing: I try to gray a menu item, the codes as follow: CMenu *pMenu = GetMenu(); CMenu *pOP = pMenu->GetSubMenu(2); pOP->EnableMenuItem(ID_OP_START, MF_GRAYED | MF_BYCOMMAND); ****************************************************** The menu item with ID ID_OP_START is supposed to be grayed and GetMenuState() does return MF_GRAYED; but the item is actually not grayed and can still function as it does. Do I need to do something in order for this method to work? Thanks a lot!

    C / C++ / MFC question

  • AddString() fails, WHY???
    W Wenrich

    It's strange, isn't it? HELP!

    C / C++ / MFC question

  • AddString() fails, WHY???
    W Wenrich

    return value from both AddString() and InsertString() is 0; but it's supposed to be inserted at the end, therefore should be some positive value(my combox is not empty). Any more information? Thanks!!!!!!!

    C / C++ / MFC question

  • AddString() fails, WHY???
    W Wenrich

    I try to manipulate strings of a combox dropdown list, codes as shown below: ((CComboBox *)GetDlgItem(IDC_COMBOBOX))->DeleteString(1); ((CComboBox *)GetDlgItem(IDC_COMBOBOX))->AddString(CString("hello")); ((CComboBox *)GetDlgItem(IDC_COMBOBOX))->InsertString(-1, CString("hello")); The first line works, but the second and third lines fails (nothing happens there, the program can go on executing). WHY??? So frustrating! Did i need to do something before adding/inserting a string? Thanks a lot!!! Wenrich

    C / C++ / MFC question

  • What's the class name registered by MFC?
    W Wenrich

    In my application, i want to use FindWindow(className, windowTitle) to determine whether an instance of this application has already been running. But what is the class name registered by MFC? let's say, the project name is "Myapp", and classes CMyappApp, CMyappDoc, CMyappView, CMainFrame are created by VC++. i tried them but none worked. Please help me! Thanks a lot!!!!

    C / C++ / MFC c++ question help

  • How to detect whether network is available?
    W Wenrich

    Hi, I'm writing application for PDA to communicate with a PC server. After the dial-up connection is established, i purposely disconnect the connection, but my program can't detect it and just happily tries to send/receive data. I even suspect that recv() never returns after connection is gone. So my questions are: how to detect whether network is available(i think IE does a good job)? and is it true that recv() can't return when network is gone? if so, how to recover? Thanks a lot!!! Wenrich

    C / C++ / MFC sysadmin tutorial question career
  • Login

  • Don't have an account? Register

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