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
Y

yccheok

@yccheok
About
Posts
97
Topics
76
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Is there any good C# desktop library to implement Card liked UI dashboard?
    Y yccheok

    In the video, it shows how "Card liked UI dashboard" look like. Also, this is a JavaScript implementation of "Card liked UI dashboard" - Column grid demo[^] As you can see, the JavaScript example supports drag-n-move, and resizing. Any idea on where I can get an equivalent C# desktop library to implement such? Thanks.

    C# c++ csharp android design data-structures

  • Is there any good C# desktop library to implement Card liked UI dashboard?
    Y yccheok

    I have been away from Windows desktop development environment (Using C++ MFC) for many years. Recently, I plan to port an Android app to Windows desktop environment. I plan to use C# as my tech stack. However, I have 0 clue on how to develop a - Card liked UI dashboard - Achieve drag-n-move animation Our Android app looks like - Drag and move animation - YouTube[^] Do you have any suggestion library, which can help me to implement so? Thank you.

    C# c++ csharp android design data-structures

  • Using WM_USER, WM_APP or RegisterWindowMessage
    Y yccheok

    After reading Joseph M. Newcomer's article (http://www.flounder.com/messages.htm), he is favoring in using RegisterWindowsMessage However, there are some concern that, RegisterWindowsMessage may lead to resource exhaustion. http://stackoverflow.com/questions/1192204/can-abusing-registerwindowmessage-lead-to-resource-exhaustion My situation is, I have a EXE with multiple DLLs. Each DLLs doesn't aware of each other DLL. Hence, the situation might happen if I am using WM_APP (Joseph M. Newcomer mark WM_USER as obsolute) DLL_A.dll is sending DDL_A_REFRESH_MY_VIEW_MSG (WM_APP + 100) DLL_B.dll is sending DDL_B_REFRESH_MY_VIEW_MSG (WM_APP + 100) Does this mean, RegisterWindowsMessage will be the best choice, even my communication only tend to within a single process?

    C / C++ / MFC question

  • Using WM_USER, WM_APP or RegisterWindowMessage
    Y yccheok

    Currently, I have a Windows EXE application, with several loaded DLLs. DLLs need to communicate with my windows application through PostMessage and SendMessage. The Windows EXE application + DLLs are all within a single process. The message should be private among EXE and DLLs. I was wondering, should I use + WM_USER based message + WM_APP based message or RegisterWindowMessage and why? What happen if there is an external process (another exe), trying to FindWindow of my Windows application, and send the message with same ID? I wish not to respond, as I am only interested message from DLLs within my own process.

    C / C++ / MFC question

  • Resource conflict on ON_UPDATE_COMMAND_UI
    Y yccheok

    I cannot use your suggestion as I am using extension DLL. http://support.microsoft.com/kb/161589 However, I already did a similar thing even before your suggestion.

    void DLL::OnContextMenu(CWnd* pWnd, CPoint point)
    {
    RestoreDLLState ext;
    ...
    }

    RestoreDLLState will load global DLL resource, and load back its original resource once done.

    RestoreDLLState::RestoreDLLState()
    {
    m_hInstOld = AfxGetResourceHandle();
    AfxSetResourceHandle(g_hResource);
    }

    RestoreDLLState::~RestoreDLLState()
    {
    AfxSetResourceHandle(m_hInstOld);
    }

    It doesn't work. :(

    C / C++ / MFC question sharepoint learning

  • Resource conflict on ON_UPDATE_COMMAND_UI
    Y yccheok

    Do you mean code like this ?

    void EXE::OnUpdateExeButtonResource(CCmdUI* pCmdUI)
    {
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    pCmdUI->Enable(exe_flag);
    }

    No. It doesn't work. Clicking on DLL's menu item will still have no effect. Is changing

    #define DLL_RESOURCE_ID 1234

    to

    const int DLL_RESOURCE_ID = ::RegisterWindowMessage(_T("DLL_RESOURCE_ID"));

    a elegant solution (To avoid resource ID conflict)? I don't know.

    C / C++ / MFC question sharepoint learning

  • Resource conflict on ON_UPDATE_COMMAND_UI
    Y yccheok

    I have an EXE class which contains a button resource with ID EXE_BUTTON_RESOURCE

    ON_UPDATE_COMMAND_UI(EXE_BUTTON_RESOURCE, OnUpdateExeButtonResource)

    void EXE::OnUpdateExeButtonResource(CCmdUI* pCmdUI)
    {
    pCmdUI->Enable(exe_flag);
    }

    This EXE application will load another DLL class. DLL class is having a menu item resource with ID DLL_MENU_RESOURCE. Unfortunately, EXE_BUTTON_RESOURCE and DLL_MENU_RESOURCE is having the same resource ID. To avoid them have conflict ID is pretty difficult, as they are two separate projects. Whenever exe_flag, which is the member for EXE turn to false, this will affect menu in DLL too. Clicking on DLL_MENU_RESOURCE menu will have no effect at all. How can I avoid this trap? Having manual inspection on their resource.h files is not an option for me, as they are 2 separate projects, managed by 2 separate teams.

    C / C++ / MFC question sharepoint learning

  • Get mouse clicked component
    Y yccheok

    Current, I have a parent CWnd, which is displaying many other child CWnds. All my message handling job are being done in parent CWnd, as I do not have access to child CWnds' code. I wish to know which child CWnds is being clicked. I can detect the right click

    afx_msg void OnContextMenu(
    CWnd* pWnd,
    CPoint pos
    );

    pWnd will be the clicked child window. However, how about left click? I know I can get the mouse coordinate, and perform some calculation accordingly to iterate through see which child CWnds falll into the point. However, I just don't want to go through all this. I which I can have something like.

    CWnd* childWind = mouseEvent.getParent();

    C / C++ / MFC question career

  • web.config error in Cassini 2.0
    Y yccheok

    Hello all, I have a web application, which I had developed few years ago with ASP .NET 1.1 Today, I would like to deploy the web application to client, using ASP .NET 2.0 + UltiDev Cassini 2.0 I locate my whole project in a folder named C:\website\GOWatch My setting in UltiDev Cassini 2.0 is as follow : Application = GoWatch Port Number = 2040 Physical Path = C:\website\GOWatch When I try to access an URL http://localhost:2040/DesktopPC/login/Login.aspx (The login.aspx is located physically at C:\website\GOWatch\DesktopPC\login\Login.aspx), I get the following error : Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. Source Error: Line 7: Line 8: Line 9: Line 10: Line 11: Source File: C:\website\GOWatch\desktoppc\login\web.config Line: 9 In my entire application, any sub folder with web.config will have the similar error. Please take note that, there are NO web.config in C:\website\GOWatch, is this the root cause of the error? Here is the content of my web.config in C:\website\GOWatch\desktoppc\login\web.config Help are ve

    ASP.NET help csharp windows-admin question workspace

  • Inverse Of Semaphore
    Y yccheok

    Hi all, Semaphore give us the following behavior count thread state ---------------------------- 3 -> no wait 2 -> no wait 1 -> no wait 0 -> WAIT However, I am looking for some tool which enable me to do this : count thread state ---------------------------- 3 -> WAIT 2 -> WAIT 1 -> WAIT 0 -> no wait I know that I can achieve my objective with the combination of : while(WaitForSingleObject(semaphore, 0) == WAIT_OBJECT_0) { WaitForSingleObject(event, INFINITE); } When the other instances start, they each increments the semaphore with ReleaseSemaphore(). When they exit, each decrements the semaphore counter and fires the event. The problem with this approach is, the first instance would hang if any of the other instances terminates abnormally. Any better suggestion, which I can achieve my objective by just using a single primitive tool? Thanks

    C / C++ / MFC help question

  • Disable pause/break key in console application
    Y yccheok

    Hi all, I would like to disable the 'Pause/Break' key in a console application. Normally, pressing the 'Pause' key halts the application's execution. However, this may lead to undesirable processing gaps in my system. Hence, I would like to disable/ break key in my console application. How can I do so? I tried SetConsoleCtrlHandler. It only able to capture the following events, not "pause" event. Do I need to do it in OS level? CTRL_C_EVENT CTRL_BREAK_EVENT CTRL_CLOSE_EVENT CTRL_LOGOFF_EVENT CTRL_SHUTDOWN_EVENT Thank you. cheok

    C / C++ / MFC question

  • having user thread update listViewItem.BackColor
    Y yccheok

    Hello all, I try to have user thread to perform update on the window form list view item back color. However, I can see the new item was added each time. However, the back color just not changed until I move the window around. May I noe what code I had missing out? Thank you very much! delegate void OnGUIDelegate(int msgID, object param1, object param2); public void OnGUI(int msgID, object param1, object param2) { // Make sure we're on the right thread if(listView1.InvokeRequired == false) { switch(msgID) { case GUIMessage.MSG_ERR: if(param1 is string) { string strDate = DateTime.Now.ToLongTimeString(); string[] s = {strDate, (string)param1}; ListViewItem listViewItem = new ListViewItem(s); listViewItem.StateImageIndex = 2; listViewItem.BackColor = Color.FromArgb(255, 224, 192); listView1.Items.Add(listViewItem); isSave = false; } break; case GUIMessage.MSG_INFO: if(param1 is string) { string strDate = DateTime.Now.ToLongTimeString(); string[] s = {strDate, (string)param1}; ListViewItem listViewItem = new ListViewItem(s); listViewItem.StateImageIndex = 0; listViewItem.BackColor = Color.FromArgb(192, 255, 192); listView1.Items.Add(listViewItem); isSave =

    C# question announcement

  • forward declare member function so that it can be friend function
    Y yccheok

    currently, i have a private function in cat named privateFun. i would like to have this function "private" to all except dog's action member function. by using the following approach, all the dog's members can access all the cat's private members. // cat.h // #ifndef CAT_H #define CAT_H // forward declaration. class dog; class cat { private: friend class dog; void privateFun() {} }; #endif // // cat.h // dog.h // #ifndef DOG_H #define DOG_H #include "cat.h" class dog { private: void action() { cat c; c.privateFun(); } }; #endif // // dog.h however, i would like to have ONLY dog's action member function to access cat's private members. i try the following approach but can't work. // cat.h // #ifndef CAT_H #define CAT_H // forward declaration. class dog; class cat { private: friend void dog::action(); /* HERE IS THE CHANGES AND COMPILATION ERROR HAPPENS HERE. */ void privateFun() {} }; #endif // // cat.h // dog.h // #ifndef DOG_H #define DOG_H #include "cat.h" class dog { private: void action() { cat c; c.privateFun(); } }; #endif // // dog.h Of course, i would get the following compilation error: c:\Documents and Settings\YC Cheok\Desktop\aaa\cat.h(10): error C2027: use of undefined type 'dog' However, I just cann't include the dog header file into cat. This will introduce circular include problem. Any advice? Can I have something like member function forward declaration? Thank you very much

    C / C++ / MFC help question learning

  • should we prefer deque over vector
    Y yccheok

    after reading http://www.codeproject.com/vcpp/stl/vector\_vs\_deque.asp, i realize that deque has its own speed advantage over vector in all the aspect (except for memory deallocation). does it mean that we should prefer deque over vector? (in contrast with c++ standard, which recommence vector over deque) thanks!

    ATL / WTL / STL c++ performance com graphics question

  • Making Forward Declaration Class's enum Member Visible
    Y yccheok

    hello all, how can i make, a forward declaration class's enum member, being visible by another class? consider the following case, ---------------------------- dog.h ---------------------------- #ifndef DOG_H #define DOG_H // class forward declaration. class cat; class dog { public: enum dog_enum { d0, d1, d2 }; void speak(cat *c); }; #endif ---------------------------- cat.h ---------------------------- #ifndef CAT_H #define CAT_H #include "dog.h" class cat { public: void speak(dog *d, dog::dog_enum e); }; #endif The above cat and dog just work fine. Now, let me create an enum type for cat too. ---------------------------- dog.h ---------------------------- #ifndef DOG_H #define DOG_H // class forward declaration. class cat; class dog { public: enum dog_enum { d0, d1, d2 }; // OPPS! HOW DO WE FORWARD DECLARE ENUM??? void speak(cat *c, cat::cat_enum e); }; #endif ---------------------------- cat.h ---------------------------- #ifndef CAT_H #define CAT_H #include "dog.h" class cat { public: enum cat_enum { c0, c1, c2 }; void speak(dog *d, dog::dog_enum e); }; #endif My question is, how can "dog" see the cat_enum, which is re-inside cat? I was understand that forward declaration for enum is not allowed in c++. Is there any workaround for this? Thank you very much

    C / C++ / MFC question c++

  • Can I delete CWinThread (m_bAutoDelete = false) even It hasn't finished
    Y yccheok

    Hello all, I have several CWinThread which I created using AfxBeginThread m_bAutoDelete = FALSE ResumeThread After I perform WaitForSingleObject and time out occur (which mean the CWinThread is still running), can I still safely delete them? Thank you very much

    C / C++ / MFC question

  • Some question on RPC Memory allocation
    Y yccheok

    Hello all, by refering to article http://www.codeproject.com/internet/rpcintro1.asp, i was wondering if i allocate an memory at server side, the return the pointer. // Server function. const char* Server::Output() { m_pVar = new char[1024]; return m_pVar } m_pVar is Server class member. Server will delete m_pVar in its destructor. However, may I know once the Client receive the pointer, // Client code const char* m_pClientPointer = Output(); does client need to perform deletion on m_pClientPointer? Thank you!

    C / C++ / MFC question com sysadmin performance

  • Calling RpcServerUseProtseqEp after RpcMgmtStopServerListening
    Y yccheok

    Hello all, By following article at http://www.codeproject.com/internet/rpcintro1.asp and http://www.codeproject.com/internet/rpcintro2.asp, I was able to have RPC feature in my application. However, I realize that even I successfully call the RpcServerUseProtseqEp for the first time. I will have problem calling the same function, with same parameters at the second time, after I close all the RPC resource using RpcMgmtStopServerListening. I will get the following error result: RpcServerUseProtseqEp failed. The endpoint is a duplicate. (1740) The sequence of my RPC server is as follow, RpcServerUseProtseqEp-> RpcServerRegisterIf-> RpcServerListen (In another thread)-> RpcMgmtStopServerListening-> RpcServerUseProtseqEp (Opps! Fail at here) Any idea on how I can restart the RPC service after I end it? Thank you yccheok

    C / C++ / MFC help com sysadmin question learning

  • use a const variable as opposed to #define - Multiple const objects created
    Y yccheok

    Hem... dun think that is the root cause of this problem. since #ifndef...#define pair had already served the purpose for #pragma once...

    C / C++ / MFC c++ html com beta-testing tutorial

  • use a const variable as opposed to #define - Multiple const objects created
    Y yccheok

    Recently, I try to replace #define with const in header file. However, there are concerns on, multiple const object will be created, if the header file is included in multiple cpp files. For example: In version.h ------------ #ifndef VERSION #define VERSION #include const std::string version("alpha_0-22"); #endif In main.cpp ------------ #include #include "version.h" extern void fun(); int main() { printf("address of version in main=%p\n", &version); fun(); getchar(); } In fun.cpp ------------ #include #include "version.h" void fun() { printf("address of version in fun=%p\n", &version); } The output of the program will be: address of version in main=00431960 address of version in fun=00431984 It seems that two copies of version string had been created if version.h is included in different cpp file scope. Now I am worry if version.h file is included in thousand of cpp files, will thousand of version string object be created?! My alternative workaround on this is, I will let version.h declare the version string and version.cpp define the version string. In version.h ------------ #ifndef VERSION #define VERSION #include extern const std::string version; #endif In version.cpp -------------- #include "version.h" const std::string version("alpha_0-22"); Again, here is my output: address of version in main=00431960 address of version in fun=00431960 It seems that the const string just be constructed one time only. I am not sure whether this is the correct workaround? Or my concern on multiple creation of const object is not an issues? Please refer to http://www.parashift.com/c++-faq-lite/newbie.html#faq-29.7 on why I am using const instead of const. Thank you for your feedback. yccheok

    C / C++ / MFC c++ html com beta-testing tutorial
  • Login

  • Don't have an account? Register

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