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
B

beko

@beko
About
Posts
55
Topics
13
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • DLL and STL in function parameters
    B beko

    Dear Ash, Thank you for such a detailed answer, at first i thought i can have data set and implement different operations on that data set (Area, Perimeter and some clipping operations) Defining an interface and hide the data in concrete classes and use interface functions to operate on is another perhaps better way. I had already looked into below link. Mature Approach part is similar to yours except virtual destructor is replaced by a Release() method and Smart Pointer calls that function for clean-up. HowTo: Export C++ classes from a DLL[^] Again thank you for the answers. Best Regards.

    C / C++ / MFC c++ graphics question announcement

  • DLL and STL in function parameters
    B beko

    Hi Moak, I was about to write that function and ask :) and saw your message. When I use, then i can safely give the vector's first element as reference to the function and vector's size.

    std::vector points;
    ....

    if(!points.empty())
    calcPerimeter(&points[0], static_cast(points.size());

    Best Regards. Bekir.

    C / C++ / MFC c++ graphics question announcement

  • DLL and STL in function parameters
    B beko

    Thank you for the answers. I will look at options to remove that STL vector, any recommendations ? Bekir.

    C / C++ / MFC c++ graphics question announcement

  • DLL and STL in function parameters
    B beko

    Hello, I wanted to move the implementation of some of my functions to a DLL and update only the DLL and do not touch the GUI.I normally use STL and i learnt that STL and DLLs together can create some problems. Lets say i have such a function below and that Point3D vector will be given from another DLL (which deals IO stuff). 1. DLL

    TEST_API double calcPerimeter(const std::vector<Point3D>& pts)
    {
    double p = 0.0;
    for(std::size_t i = 1; i < pts.size(); ++i)
    p+= calcDistance(pts[i-1],pts[i], false);

    p = sqrt(p);
    return p;
    

    }

    2. DLL i want to export a std::vector from a function. Will this work or even if it works under what conditions? By the way, I will use the same compiler for exe and dlls. How will you implement above? (a very simple data holder (Point3D vector) in a DLL and in another DLL just bunch of functions which operates on that data? Best Regards. Bekir.

    C / C++ / MFC c++ graphics question announcement

  • Resolution for Dialog
    B beko

    You can adjust your sizes with respect to maximum width and height available. for example your ratio for 900(in 1028x1024) is 900/1024 and for 800x600, it will be 600*900/1024. Perhaps this[^] could also help.

    C / C++ / MFC question

  • truncating float
    B beko

    Hello i use the following in order to truncate a double value (found somewhere and modified :) ) However you must be careful in here, because there could be an overflow in double fac = Num/Seed

    #include <math.h>
    #include <stdio.h>

    double truncate(double Num, double Seed)
    {
    // get rational factor
    double fac = Num / Seed;

    // get natural factor
    fac = (fac < 0) ? (ceil(fac)) : (floor(fac));
    // fac = (fac < 0) ? static\_cast<int>(fac-0.5) : static\_cast<int>(fac+0.5);
    
    // return multiple
    return fac \* Seed;
    

    }

    int main()
    {
    double val = 4./3.;

    printf("%6.4f\\n",truncate(val,1e-04));
    
    return 0;
    

    }

    C / C++ / MFC question tutorial lounge

  • Running a windows service in Windows7
    B beko

    I do not know if this is the right place to ask this question but, I have written a windows service which polls serial port for serial activity and an input device writes out the port with some time interval. In other words, whenever a write occurs, the service reads and process that and make available to another program. Since it would be a waste of time and resource to poll the port all the time, i was starting the service when the main application is running and stopping it when the program exits. However, this scenario does not work for Windows7 and i could not test it but probably for vista as well. I used OpenSCManager with CONNECT but cannot open the service with SERVICE_START or SERVICE_STOP privilege. any idea, how can this be solved? (I am currently reading some UAC stuff but have not found something yet) Best Regards

    C / C++ / MFC question learning

  • Render multiple object in single view
    B beko

    Hello, you can define a draw function for each object in its class, and make that class inherited from an interface. class Object { ..... virtual void draw() = 0; .... }; class Circle : public Object { virtual void draw() {} }; and call each objects'draw method in the view. you may also want to look at the visitor pattern. Hope this helps. Bekir.

    C / C++ / MFC c++ oop question

  • version change
    B beko

    Hello If you are just using standard features which are also available with VS2005, just change version number to 8.0 and also do relative changes and apply the same for vcproj file (just version number change,etc.). I learnt this in here from someone couple of weeks ago and it is working for me so far. Hope this helps. Bekir.

    C / C++ / MFC visual-studio question announcement

  • Writing a similar function as ComboBox SelectString
    B beko

    Thank you, this is what i was looking for :thumbsup: Bekir.

    C / C++ / MFC

  • Writing a similar function as ComboBox SelectString
    B beko

    Hello, I have a STL map and string values as the key values However recently, i want to search this map as it is like auto-complete ComboBox. For example,I have keys in the map as such Apple, Pearl, Orange. When i enter 'A' i want to return Apple from the map. I know that i can iterate thorough each map object and compare its key, but i think that would inefficient. Any ideas ? Bekir.

    C / C++ / MFC

  • calculate polygon area and its centre in 3d
    B beko

    Thank you, i will try that and i think it will solve the problem but it will create a bit of overhead. Bekir.

    Algorithms

  • calculate polygon area and its centre in 3d
    B beko

    Hello, I have some 3d points (not self intersecting). the shape of the points is looking like / (forward slash) from profile, It is actually a slice of a 3d object, cut with a rotated plane. I want to calculate the area of 3d points and its centre. For 2d case, i use the following http://local.wasp.uwa.edu.au/~pbourke/geometry/polyarea/[^] but, how can i extend the 2d case to 3d for area and its centre? Thanks in advance. Bekir.

    Algorithms

  • Regarding application expiration
    B beko

    Hello, Either limit the number of days also or if you are providing a license, do not proceed if the supplied date is earlier than the start date of the license. You could also use both, if you want it. The only drawback of this approach is that, if the user changes the date to an earlier date for any purpose (reports :)), and mistakenly opened your program also, he/she would be pissed off ;P . Bekir.

    C / C++ / MFC help

  • Regarding application expiration
    B beko

    Hello, you can save the current date every time the program runs, so you can check against the date for alterations. Hope this helps Bekir.

    C / C++ / MFC help

  • GetProfileString creates a key automatically
    B beko

    Hello, I am using GetProfileString to read from registry, the registry keys are created via setup and i should check if there is an option set, and the program should act accordingly. For example; MyApplication Data Data01 I have to check if Data01 available, if yes then read its setting from the registry, otherwise do the default handling. However when i check if Data01 available, GetProfileString creates that entry for me :), if that entry is there no problem but if it is not, then it automatically creates. You can see how i am trying to check.

    CString category(_T("Data\\"));
    category+=dataCode; // DataCode could be Data01 or Data02 i dont know this before hand.
    path = GetProfileString(category,_T("InitPath"));

    How should i check if an entry there using GetProfileString or how can i do it? Thanks in advance. Bekir.

    C / C++ / MFC question windows-admin help tutorial workspace

  • Placing an image to main window, like IE
    B beko

    i found what i want to do in here, lots of digging :). http://www.codeguru.com/cpp/controls/menu/bitmappedmenus/article.php/c3725/[^] Best Regards. Bekir.

    C / C++ / MFC question c++

  • Placing an image to main window, like IE
    B beko

    Hello, I want to put an image,like a logo, to the right of the main window of my application, just like Internet Explorer. What is the best way to implement? (Using MFC) Thanks in advance. Bekir

    C / C++ / MFC question c++

  • creating spline thru n points (c/c++)
    B beko

    Natural cubic splines or clamped, check the implementation at http://www.as.ysu.edu/~faires/Numerical-Analysis/DiskMaterial/programs/C/[^] Algo 3.4 and 3.5 any numerical analysis book with interpolation section might help. Of course, due to the nature of the curve, the curve passes directly through the provided points. Bekir.

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

  • Hide/Remove the Application Icon in the Title bar icon for a dialog with Border - Resizing.
    B beko

    Hello, Right click on the dialog, go to Properties then Select Right Align Text in the misc. category It does change where the title bar is located, but not sure that is exactly what you need. Hope this helps. Bekir.

    C / C++ / MFC tutorial 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