User Profile

Collapse

Profile Sidebar

Collapse
emibt08
emibt08
Last Activity: Jul 16 '10, 11:12 PM
Joined: Oct 22 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • How to get the Exe name of a process spawned through CreateProcess with cmd.exe?

    In an application that I currently writing I stumbled at a very annoying problem that i've been trying to solve for hours to no avail.
    I create a process using CreateProcess() Win32 API, passing NULL as the first arg, and the 2nd arg is in the form:

    TEXT("cmd.exe /c AppName Args..")

    That works pretty good, but then i want to find out the name of the exe that was started. The above syntax would make CreateProcess...
    See more | Go to post

  • emibt08
    replied to c function/code to test number
    in C
    donbock, thanks for ponting that out.
    I wanted to give to the user a simple function that does what he wants to accomplish since it's pretty simple. However, I guess I shouldn't have because of what you said about the forum's goal. I apologize for that.
    since I already posted the function, I just fixed it to address the issues that you found in it....
    See more | Go to post

    Leave a comment:


  • emibt08
    replied to c function/code to test number
    in C
    Code:
    bool isValidNumber(const std::string& str)
    {
        size_t len = str.length();
     
        if (!len)
            return false;
     
        char ch = str[0];
     
        if (1 == len)
            return isdigit(ch);
     
    	bool hasDot = false;
    	
        if (!isdigit(ch) && '+' != ch && '-' != ch)
    	{
    		if ('.' == ch)
    			hasDot = true;
    		else
    			return
    ...
    See more | Go to post
    Last edited by emibt08; May 6 '10, 02:53 PM. Reason: fixed bugs pointed by donbock

    Leave a comment:


  • You could of course make a base class which takes your struct (possibly in the constructor) and derive all other classes that use it from that base class.
    The base class would have the struct as a protected member (or private with accessor functions), and you may put there all of your common functions declared as virtual if something in the derived classes needs to be done differently. Eg:

    Code:
    class Base
    {
    	Base(params*
    ...
    See more | Go to post

    Leave a comment:


  • Thanks for your response Banfa, that clears up the hesitation.
    See more | Go to post

    Leave a comment:


  • Do I need to lock socket access when transferring data in multi-threaded application?

    Hi,

    I have an application that I recently revised. It transfers data between 2 programs, including files as well as small data chunks. I never had a problem (got garbage at the other side) or anything like that, but I am curious whether I need to lock the socket access when i am sending. An oversimplified example of a single send would be like:

    Code:
    bool sendData(SOCKET sock, uint32_t size, const char * data)
    ...
    See more | Go to post

  • Thank you for your response Banfa. It seems that I forgot to link the object files at the end :-|
    It's all good now. Thank you
    See more | Go to post

    Leave a comment:


  • emibt08
    started a topic What is the recommended directory structure for tests?
    in C

    What is the recommended directory structure for tests?

    I am starting to work on a project and want to have unit-testing. So, i initially laid out my directory structure like this:

    project/src/
    project/doc/
    project/tools/
    project/tests/

    However, I bumped into a problem which I didn't consider before. When I include some class in my tests i am getting "unresolved external symbol". Most likely because the h/cpp files are outside of the tests/...
    See more | Go to post

  • emibt08
    replied to How can an object ask to be deleted?
    in C
    Thanks for the reply... however, after checking the observer pattern a little better, I doubt it applies here. I could use it to notify the main thread that the object is finished with the processing, but with that pattern i may have more than 1 observer. In my case, I have only one, so it's not a problem, but if i had more and the 1st deleted the object, then i suppose the object can't notify the others (or i am not even sure what will happen)....
    See more | Go to post

    Leave a comment:


  • emibt08
    started a topic How can an object ask to be deleted?
    in C

    How can an object ask to be deleted?

    I have a class, say Container which contains objects of another class, for example MyObject. MyObject does some processing, and in some future time it is no longer needed. Hence, it should somehow tell to the Container about it. I currently do something like this:

    Code:
    class MyObject
    {
    public:
    	typedef void(*PFN)(void*,MyObject*);
    	MyObject(void* param, PFN p) : m_param(param), m_pfn(p) {}
    	// some other
    ...
    See more | Go to post

  • emibt08
    started a topic How to add sockets in select() while waiting?
    in C

    How to add sockets in select() while waiting?

    I have an application which acts as a server and a client. So, it accepts incoming connections, but also establishes connections. I have a class dedicated to the listening, where the listening sockets reside. Another class establishes connections.

    Whether I accept or open a connection, the connected socket goes into another class which does I/O on the connected socket(s). The problem is in this class. I currently use select(), which...
    See more | Go to post

  • emibt08
    started a topic How to expose API from executable?
    in C

    How to expose API from executable?

    Hello,
    I have an application which is a server. Then, a client connects to it through a socket connection. Now, the thing is that I want to make a web front-end for the server, so the web interface will have almost the same functionality as my client application.
    I think that the best approach would be to expose API from my server and then use it for communication. For example, the web back-end (which would be located at the same box...
    See more | Go to post

  • emibt08
    replied to pure virtual static function :/
    in C
    Thanks for the suggestion newb16. However, it won't work for me. I am sorry for not being clear enough. Well, this is how actually the scenario looks like:

    Code:
    class CAbstract
    {
    	//...
    protected:
    	virtual int Calculate(int nID, int nVal) = 0;
    	//...
    }
    
    class CDerived : public CAbstract
    {
    	//...
    public:
    	virtual int Calculate(int nID, int nVal);
    private:
    ...
    See more | Go to post

    Leave a comment:


  • emibt08
    replied to Yet another thought about STL Vector
    in C
    I wouldn't implement the vector as an array. At least not as you suggested. That way, it will have very poor performance, being just an array. If it actually is implemented that way, it would also need an internal table to keep track of the memory locations and gain performance that way.
    So then, i believe that the most effective way to implement it would be as a linked list (double-linked list to allow for backward-iteration). It would have...
    See more | Go to post

    Leave a comment:


  • emibt08
    started a topic pure virtual static function :/
    in C

    pure virtual static function :/

    Hi.
    I know the title looks a little bit silly and that we can not have pure virtual static functions. But i've been wondering what approach to take to make the abstraction.
    This is the case: I have an abstract class with one pure virual function. Now, all of the classes derived from the base abstract class have a ThreadProc function, for the job that the worker threads do. They must have it because of the nature of the abstract class....
    See more | Go to post

  • emibt08
    replied to Click a button on a web page
    in .NET
    Hi. With a little delay, i want to thank Plater for the suggestion. That was what i needed. Once i post back the session header, it all worked.

    Cheers
    See more | Go to post

    Leave a comment:


  • emibt08
    replied to Windows Service accessing Excel file :(
    in .NET
    I kind of get a little frustrated with this kind of problem while working on a solution. Besides, there was not really any pointer to the right direction, and i needed the solution fast. So, i still believe it's a Vista issue, just didn't have enough time to spend on this issue.
    However, this is how i solved it and made it work. I made another small application which would do all Office (read Excel) related stuff. Then, i spawn that application...
    See more | Go to post

    Leave a comment:


  • george666
    george666 posted a Visitor Message for emibt08
    You could ask on specialized Win32 api newsgroup :
    news://comp.os.ms-windows.programmer.win32
    See more | Go to post

  • emibt08
    started a topic How to get icon from Icon Table
    in C

    How to get icon from Icon Table

    Hello fellow programmers.
    I've been stuck with a thing that i can't find any info about. I used the Windows Installer function MsiGetProductIn fo to get the property INSTALLPROPERTY _PRODUCTICON. Now, i get the data in the buffer, but as the description says:
    Primary icon for the package. For more information, see the ARPPRODUCTICON property.
    And as for ARPPRODUCTICON, the ARPPRODUCTICON property specifies the foreign key to the...
    See more | Go to post

  • emibt08
    started a topic Is the socket connected?
    in C

    Is the socket connected?

    Hi. I have an array of sockets in my application and i need to know which sockets are connected and which ones aren't. In order to do that i check if the socket equals INVALID_SOCKET or NULL, but i don't know how efficient that is.
    I wondered how can i know if some of the connected sockets loses the connection from the other side for any reason. Something like the events in the CAsyncSocket, or probably some function that can check just that,...
    See more | Go to post
No activity results to display
Show More
Working...