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
V

vmaltsev

@vmaltsev
About
Posts
37
Topics
12
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • CInternetSession and ZoneAlarm don't like each other...
    V vmaltsev

    Hi everyone, Not sure if it's a right place for my question, although it's about C++; Does anyone experienced any troubles with running code that uses CInternetSession on a computer with ZoneAlarm installed? I can't even run examples like Tear and FteTree from VC! :mad: It simply gives timeout. Looks like ZoneAlarm blocks inet access for those apps without even asking permission. :sigh: All other apps (commercial or freeware) work as intended. When they try to connect, ZoneAlarm asks if I want to block access or not. But when I build code with CInternetSession in it, including examples from some articles here, on CodeProject, it blocks access without asking. :( Is there a solution known for that problem?

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

  • Pointer to function and templates
    V vmaltsev

    Thanks for the suggestion, but it changes nothing. The problem is that I can pass as an argument only static method or global function, and it works with the template I have. But, I need to pass pointer to method of existing instance of a class. That's where I'm lost.

    C / C++ / MFC help wpf tutorial question

  • Pointer to function and templates
    V vmaltsev

    Greetings, everyone. I stuck with an error "C2064: term does not evaluate to a function taking 1 arguments" when I try to pass pointer to class method as an argument to some method in template. Let's say I have a template with public method 'UserFunction' and private recursive method 'UserFunctionRecursive' template <class TxData> class CxTemplate { public: ... template <typename TxFunction> void UserFunction(TxFunction pFunction) { UserFunctionRecursive<TxFunction>(xData, pFunction); } ... private: template <typename TxFunction4Recursion> void UserFunctionRecursive(TxData xData, TxFunction4Recursion pFunction) { if(bla-bla) UserFunctionRecursive<TxFunction4Recursion>(xData, pFunction); else !!!!=> pFunction(xData); } } and I have a class which has user function and object of that template class class CxClass { public: ... void Foo(int i) { ... } CxTemplate<int> m_xObject; } When I try to call 'UserFunction' method and pass Foo as an argument, I get the C2064 error (on line marked with !!!!=> above) CxClass obj; obj.m_xObject.UserFunction(CxClass::Foo); // error and it's quite clear why, there is no instance of that function. So we have to make it static and it'll work. But, static function has no access to non-static members, so I can't make it static. Any ideas how to make it work? :^)

    C / C++ / MFC help wpf tutorial question

  • Yet another class hierarchy problem...
    V vmaltsev

    Hail Darkbyte, No, simply because I don't have anything in C-tors except zeroing a couple of integers. Thanks for the answer though. :)

    C / C++ / MFC help question c++ debugging json

  • Compiling a single cpp file
    V vmaltsev

    It's still there. Right-click on *.cpp file in solution tree, you'll see "Compile" option there. And you can press ctrl+f7 as it was mentioned already. Cheers.

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

  • Yet another class hierarchy problem...
    V vmaltsev

    Hello everyone, I'm still struggling with my classes hierarchy. Now, what I have is pure abstract interfaces classes and correspondent to them objects classes, which are actually hidden inside dll. API.h // Unique ID class class __declspec(dllexport/dllimport) CxID { public: // C-tor, D-tor, some other methods. static const int GetID(); private: static int iID; }; // Interfaces class IxA { virtual int GetA() = 0; }; class IxB_Only { virtual int GetB() = 0; }; class IxB: public IxA, public IxB_Only { }; extern __declspec(dllexport/dllimport) IxB *GetObject(); // Just a test function DLL.h #include "API.h" class CxA: public CxID, public IxA { public: // C-tor, D-tor, some methods. int GetA() { return 0xAA; } private: ID m_ID; }; class CxB: public CxA, public IxB_Only { // C-tor, D-tor, some methods. int GetB() { return 0xBB; } }; DLL.cpp CxB *g_pObj; BOOL APIENTRY DllMain(...) { ... case DLL_PROCESS_ATTACH: g_pObj = new CxB(); break; ... } // Just a global function to return pointer on global object created in DLL __declspec(dllexport/dllimport) IxB *GetObject() { return (IxB*)g_pObj; }; Now, in application: IxB *pObj = GetObj(); So, what I want to achive by doing that is to be able to cast B object, which is hidded in dll and not known to user, to public ifaces iB and iA. But, I have a problem. (Sorry for such long introduction) When I debug my app I see this:

    pObj
    |--[CxB]
    | |--CxA
    | | |--IxA __vfptr with good address and fuctions
    | |--IxB_Only __vfptr with good address and functions
    |--IxA __vfptr with good address and functions
    |--IxB_Only __vfptr with... 0xcdcdcdcd and error CXX0030: expression cannot be evaluated

    It's obvious when I do pObj->GetB() I get "Access violation". I have no idea what is wrong. It must work, I know it. But I can't see the flaw. Please, plase, plase, somebody, any clue? Thanks in advance.

    C / C++ / MFC help question c++ debugging json

  • STL container over DLL Export
    V vmaltsev

    I presume you're talking about warning 4251. "If your project declares a class class __declspec(dllexport), and that class has members of the std::* type, you see C4251 warnings. Because all your code is built with the std::* class now statically linked, you can ignore these warnings. To explicitly disable those warnings, use the following notation: #pragma warning(disable: 4251)" This is what I do, and I've never had any problems with it. Hope it'll help you as well.

    C / C++ / MFC c++ html design docker business

  • compiling errors with xutility header file
    V vmaltsev

    Wait a second... You're using STL right? So you have to include STL classes headers (like include "vector", cuz vector is a member of STL) and suggested forward declaration "class vector" will give you nothing but an error. What to xutility error, check your code carefully for dummy errors. All I've ever got from xutility is some warnings.

    C / C++ / MFC help csharp visual-studio graphics

  • compiling errors with xutility header file
    V vmaltsev

    Could you please post operators definitions here if you have any? [UPDATE] I meant your AcGeLineSeg2d of course.

    C / C++ / MFC help csharp visual-studio graphics

  • compiling errors with xutility header file
    V vmaltsev

    Did you try to #include "vector"? :)

    C / C++ / MFC help csharp visual-studio graphics

  • C++ Def and Non-Def file - Function Signature - help!
    V vmaltsev

    Hail again, If you provide .dll, .lib and .h that means you link to a DLL implicitly and you don't need .def file then. Using a module definition file makes sense only if you want to find function entry point during run-time by using GetProcAddress and referencing a function by an ordinal rather than a name.

    C / C++ / MFC question c++ help csharp visual-studio

  • how to extract non ascii charachters from a text.
    V vmaltsev

    Well, my suggestion will be to forget about bytes and treat each character as unsigned short (WORD). In this case your character isn't ASCII if value bigger than 255 (or 127 if you want only latin chars).

    C / C++ / MFC performance help tutorial question

  • packed data strcutures
    V vmaltsev

    When you use #pragma pack(1) you can be sure your data will be aligned on one byte boundary, so will be in size exactly as you defined it. Although it works for unions and structures only.

    C / C++ / MFC help c++ json performance question

  • Math &#8220;expert&#8221; wanted&#8230; Algorithm for finding line of two crossing areas
    V vmaltsev

    Well, hail there again. Why don't you stick to one thread? Anyway, you sholdn't be a math "expert" to solve this one, but you have to know basics of geometry at least. I'll give you solution for intersection bitween line and plane, the rest you can do yourself. We have three points and a normal vector (N). The equation of a plane is Ax+By+Cz+D=0. We have two points P1 and P2. The equation of a line is P(t)=P1+t*Pd where Pd=(P2-P1), t>0. To determine if there is an intersection with the plane, substitute for P(t) into the plane equation and get A(P1x+t*Pdx)+B(P1y+t*Pdy)+C(P1z+t*Pdz)+D=0, which yields t = -(Dot(N,P1)+D)/Dot(N,Pd). Now find divisor Vd=Dot(N, Pd), if Vd=0 then the line is parallel to the plane and if Vd>0 then the normal N of the plane is pointing away from the ray (that can be useful for one-sided faces). Now we can find t, if t<0 then the line intersects the plane behind origin, i.e. no intersection of interest, otherwise we can put t in the equation of a line to find intersection point. Enjoy.

    C / C++ / MFC c++ algorithms tutorial

  • C++ - A scenario - any recommendations please?
    V vmaltsev

    Well, I must admit this scheme looks quite silly. However to find reasonable solution I think we need to clarify something. You said that you don't want to change SDK, but how do you expect users to access new function in 3rdPatry.dll? Unless of course those functions for Utility.dll use only and if this is a case then I don't see problem anymore.

    C / C++ / MFC tutorial csharp c++ sysadmin

  • Need a 3d shape class
    V vmaltsev

    I think CSG that was mentioned in previous post is too complex for your task. What you need is indeed a simple mesh object and elements of it were mentioned above as well. Let's start with a simple class for 3D point (you can call it vector if you want) with all possible geometrical manipulations like add, sub, mul, dev with point, with scalar, dot and cross products. After that you have to create a class to represent a face. If you remember geometry you know that three points in space is enough to represent a plane, so your "face" class have to include those three poins. Plus I suggest to include Normal Vector (normalized cross product of two differences between our three points, like p=b-a, q=c-a, n=cross(p,q) N=n/length(n)) which will represend visible side of a face and some props like single/double faced, shading method etc. Normal vector is very important cuz it'll help you to eliminate invisible faces on rendering stage. Another thing that we have to include in our face class is info about edges. That's all. Now to represent a normal 4-point plane you need 2 faces, so to represent a cube you need 12 faces. All boolean operation are very simple to perform on such objects. You need to solve only one equation to find points in space where two faces intersect and create new faces there. Hope it'll help.

    C / C++ / MFC tutorial

  • fread() with excel and powerpoint files
    V vmaltsev

    Well, you obviously have to know file format for that. :) I can give you a small hint. Read 2 bytes on offset 0x200. If you have 0x0009, 0x0209, 0x0409, 0x0809 it's Excel file. I don't have much data on PowerPoint format therefore my assumption can be wrong. Nevertheless, if you have 0xA046 there, it's PowerPoint XP(and 2003?). If you have 0xFDFF there, you have to read extra 2 bytes from 0x204 and if you have 0x5eca there, it's PP95 and if the value is 0x5dca, it's PP97(-2002?). Hope it'll help.

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

  • fread() with excel and powerpoint files
    V vmaltsev

    I didn't quite understand your question. Could you please rephrase it? Though by look of it you're expecting from fread to understand format of excel and word files. If so, your expectations are wrong. It's low level i/o function and knows nothing about file format, it simply read/write bytes.

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

  • Class hierarchy question...
    V vmaltsev

    Hail everyone, Let's say I have two classes, A and B, as well as two interface (abstract) classes for them, iA and iB. Class B derived from class A and interface iB, interface iB derived from iA, so we have, class iA { vitrual method AA } class A: public iA { method AA } class iB: public iA { vitrual method BB } class B: public A, public iB { method BB } By doing this I want to be able to access methods of class B (and A in it) through interface iB, but, I can't do so. Compiler justly says "pure vitual function AA was not defined in B" So, couls you please explain to me how this hierarchy should look like? Thanks in advance, any suggestion would be helpful.

    C / C++ / MFC question

  • What is the diff between ?Foo@Class and ?FooA@Class in DLL export?
    V vmaltsev

    That's it! You're absolutely right. :) Thanks a lot!

    C / C++ / MFC question com tools help
  • Login

  • Don't have an account? Register

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