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
A

ajitatif angajetor

@ajitatif angajetor
About
Posts
27
Topics
9
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • pointer problem :)
    A ajitatif angajetor

    thanks, the article was really helpful. i used BSTR to pass the array safely among processes. i thought i needed some structure like BSTR for this, but couldn't imagine the solution would be BSTR itself :) WM_COPYDATA is useful too, but since my UserBroker does not have a window, i can't send the message to anywhere else. thanks again

    C / C++ / MFC question c++ windows-admin data-structures help

  • pointer problem :)
    A ajitatif angajetor

    hi everyone, i'm working on a project which includes a DLL and a separate UserBroker (both written in ATL) object which is used for getting/setting registry keys and reading/writing to user directories. (the object will be used in Vista, so this is needed) i want to read some binary data from registry and i have written this function properly: STDMETHODIMP CUserBroker::QueryBinaryValue(BSTR bstrKeyName, BSTR bstrValueName, BYTE **pValue, ULONG *pnBytes) the function body is simple. it just opens the registry key (using a CRegKey) and uses its QueryBinaryValue method. the problem is somehow i just can't pass a BYTE array to the other process (which calls the CUserBroker's method). the call to the method is this: arr = (BYTE *)malloc(1 * sizeof(BYTE)); pub->QueryBinaryValue(ATL::CComBSTR(s_bstrToolBarRegistryKey), ATL::CComBSTR("hop"), &arr, &dwSize); arr = (BYTE *)realloc(&arr[0], (dwSize) * sizeof(BYTE)); pub->QueryBinaryValue(ATL::CComBSTR(s_bstrToolBarRegistryKey), ATL::CComBSTR("hop"), &arr, &dwSize); delete arr; everything works fine until the first line of CUserBroker::QueryBinaryValue method, where the BYTE** pointer points to BadPtr (0x00000000) immediately. the question: how can i pass a BYTE array (or any other array) among processes?

    C / C++ / MFC question c++ windows-admin data-structures help

  • how to get the VARIANT type URL as a CString from OnDocumentComplete in webbrowser2
    A ajitatif angajetor

    you can use the V_BSTR macro to get it done. the macro returns a BSTR that you can use to obtain a CString. something like this may help/work: BSTR bstrUrl = V_BSTR(URL); CString cstrUrl(bstrUrl);

    C / C++ / MFC c++ tutorial question

  • Multiple Inheritance by IDispatch
    A ajitatif angajetor

    :-D uuuuuuh,no. I added an IDispEventImpl to inheritance list and it worked.Great help,thanks:)

    ATL / WTL / STL help com oop question

  • Multiple Inheritance by IDispatch
    A ajitatif angajetor

    Hi everyone, I have a class that implements an interface that derives from IDispatch directly,and I want to add a new interface which also derives from IDispatch,and then derive my class from this interface too.Expectedly,my problem is ambiguouty (did I spell it correctly??).I use COM_INTERFACE_ENTRY2 macro,but i keep getting error "cannot instantiate abstract class" error in atlcom.h this is the IDL file:

    library TheLibrary
    {
    	importlib("stdole2.tlb");
    	[
    		object,
    		uuid(),
    		dual,
    		nonextensible,
    		helpstring("Primary dispatch interface for the class."),
    		pointer_default(unique)
    	]
    	interface ISomething : IDispatch
    	{
    	};
    
    	[
    		uuid(),
    		helpstring("help string.")
    	]
    	coclass CSomething
    	{
    		[default] interface ISomething};
    
    	[
    		uuid(),
    		nonextensible,
    		helpstring("the new Interface"),
    	]
    	dispinterface INewInterface
    	{
    	properties:
    	methods:
    			[id(0), helpstring("method default"), local] HRESULT DefaultMethod(void);
            };
    

    and this is the COM mapping

    	BEGIN_COM_MAP(CSomething)
    		COM_INTERFACE_ENTRY(ISomething)
    		COM_INTERFACE_ENTRY2(IDispatch, ISomething)
    		COM_INTERFACE_ENTRY(IObjectWithSite)
    		COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IDeskBand)
    		COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDeskBand)
    		COM_INTERFACE_ENTRY(IDeskBand)
    		COM_INTERFACE_ENTRY_IID(IID_IInputObject,IInputObject)
    		COM_INTERFACE_ENTRY(IPropertyNotifySink)
    		COM_INTERFACE_ENTRY(INewInterface)
    	END_COM_MAP()
    

    I tried using interface instead of dispinterface.Didn't help either.I know I'm missing something,but can't figure out what it is...

    ATL / WTL / STL help com oop question

  • Adding a new image (img tag) to the document in Internet Explorer
    A ajitatif angajetor

    Hi everone, I'm developing an Internet Explorer add-on,which will put an extra image on the document's specified location.Everything works fine,but Internet Explorer won't display the image if it is located in the local system (the user's computer,i mean).Since I'm sure the image url (formed as 'file://c:/folder/image.gif') is correct and IE displays images on the internet,I think it's a kind of security feature of IE. Does anyone have any idea on how I can put a local image on the document without asking the user to alter security settings?:~

    C / C++ / MFC security question

  • Hi All !(CString Class)
    A ajitatif angajetor

    you can try the _ttoi function to determine if the string is actually an integer. The function will return 0 if the string cannot be parsed as integer. So you should also check if user actually entered 0 in the CEditBox. "What if user enters something like 0000?" question still remains, but this is better than nothing :)

    int val = _ttoi(sCod);
    if (val == 0 && sCod != _T("0"))
    {
       AfxMessageBox(_T("Incorrect number"));
    }
    
    C / C++ / MFC help

  • int array problem
    A ajitatif angajetor

    Alternatively, you can use int pointers instead of array. This way you can check if the value is NULL

    C / C++ / MFC data-structures help question

  • Catching Key Event of an Edit Box
    A ajitatif angajetor

    I checked out the article but there's something I just can't catch: The ComboBoxEx does not recieve any WM_KEYDOWN events from the EditBox within. I used Spy++ to see that the event doesn't even get past the ComboBox control inside the ComboBoxEx. So, how can I catch the WM_KEYDOWN event when I can't catch it on the parent?

    C / C++ / MFC question

  • About Tetris game
    A ajitatif angajetor

    both questions have one answer: i guess you re-draw tetris blocks each time they move, using rectangles (RECT structure) of the block parts. so what you have to do is to check if left-most,right-most and bottom-most rectangles are inside the main window rectangle. also, the block should stop moving when the bottom-most rectangle of it touches the top-most block's rectangle on the same game column (each block part is one column wide). you can get the rectangle of the main window using GetWindowRect() function. but don't forget to use, ClientToScreen() and ClientToParent() functions when needed, they save more than just time.

    C / C++ / MFC question game-dev help

  • pointers and structures
    A ajitatif angajetor

    i couldn't catch what you exactly want, but can a constructor help you? you could create a constructor that takes these values as argument and get the values one by one from console. then, create a new books struct with the values.

    C / C++ / MFC tutorial announcement learning

  • Catching Key Event of an Edit Box
    A ajitatif angajetor

    Hi everyone, I've been digging up for a way to handle key presses (specifically CTRL+A KeyDown) for the EditBox in the ComboBoxEx in my IE toolbar and have failed everytime. I tried to handle the WM_KEYDOWN events but I just couldn't. The ComboBox won't fire any event and I want to select all the text within the EditBox when user presses CTRL+A. There must surely be a way but what could that be?

    C / C++ / MFC question

  • Menu using ATL
    A ajitatif angajetor

    first, create a menu in your resource file. second, put a button to the toolbar that will open the menu up with a style BTNS_WHOLEDROPDOWN third, get a command handler handle the button's command ( WM_COMMAND message ) and lastly, write a method that creates the menu and tracks it. something like:

    HMENU hM = ::LoadMenu(ATL::_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(ID_MENU);
    HMENU hMPopUp = ::GetSubMenu(hM,0);
    // calculate the point where the menu will show
    ::TrackPopupMenu(hMPopUp,TPM_TOPALIGN,pointX,pointY,0,m_hWnd,NULL);
    

    that's the way i did it, i think you can handle the rest with the holy MSDN

    ATL / WTL / STL c++ help

  • "Access Violation Error" Using Custom COM [modified]
    A ajitatif angajetor

    nice touch, but the moment you ask for HKEY_CURRENT_USER in a low integrity process, windows vista will give you the HKEY_CURRENT_USER\Software\LowRegistry key. so the low integrity process will read/write to a position like HKEY_CURRENT_USER\Software\LowRegistry\<user_id>\Software\LowRegistry

    ATL / WTL / STL c++ com windows-admin tools help

  • &quot;Access Violation Error&quot; Using Custom COM [modified]
    A ajitatif angajetor

    sure, here it is http://msdn.micro­soft.com/library/en-us/ietechcol/dnwebgen/protectedmode.asp

    ATL / WTL / STL c++ com windows-admin tools help

  • &quot;Access Violation Error&quot; Using Custom COM [modified]
    A ajitatif angajetor

    i'm trying to create a broker process for an internet explorer toolbar to work on windows vista. internet explorer (only in vista) puts the toolbar on low registry profile on most of the web pages (all except those in trusted zone), which gets things complicated. you open a trusted site and toolbar tries to read from HKCU, you open another site and it tries to read from HKLM\Software\Microsoft\InternetExplorer\LowRegistry... something. so what i'm doing is to use an executable file (which will always work on low profile) to do the trick. toolbar just says "save the setting", and turn away. executable will always save these settings to the LowRegistry key. this is what i understood on msdn articles, did i simply misunderstood them?

    ATL / WTL / STL c++ com windows-admin tools help

  • &quot;Access Violation Error&quot; Using Custom COM [modified]
    A ajitatif angajetor

    i created another project whose proxy-stub is merged and now the problem is resolved into another one: i use HKEY in some of the functions as in and out parameters (they use registry keys), and my IDL file thinks HKEY is void *, contrary to the caller class, which sees HKEY as struct HKEY__* (as it should). i think this causing inconsistency between the client and the server, since i get "bad variable type" (or something similar) from CoCreateInstance only when there is a method with a parameter typed HKEY in the server. i tried redeclaring HKEY in IDL file,including winnt.h but no luck. any hope here?

    ATL / WTL / STL c++ com windows-admin tools help

  • &quot;Access Violation Error&quot; Using Custom COM [modified]
    A ajitatif angajetor

    hi everyone, i created a custom COM component (.exe) which is used by another .dll. i compiled the both components fine, including the code snippet below; but i get a runtime access violation error on line of exe->Dummy() after CoCreateInstance returns S_OK. it gives different addresses for each different method of the .exe component i try. this code is inside a method of the .dll component HRESULT hr = 0; ATLVERIFY(SUCCEEDED(CoInitialize(NULL))); ATL::CComPtr exe; hr = exe.CoCreateInstance(CLSID_Something,NULL,CLSCTX_LOCAL_SERVER); // call out for .exe component ATLASSERT(SUCCEEDED(hr) && exe != NULL); ATLVERIFY(SUCCEEDED(exe->Dummy())); // access violation here exe.Release(); // doesn't make it to here anyway My .exe component is non-attributed just like the .dll (not sure if it makes any difference), i have built and registered the proxy-stub class fine, and also my .exe file is registered with "exe /RegServer". i think there is one more thing to be done but just couldn't find out what. if it were the registry script or something, i shouldn't be getting an instance of the .exe component. any ideas ? please have some !! -- modified at 14:18 Thursday 22nd March, 2007 edit: i converted the .exe interface to be non-dual (it was a dual interface before) and this time exe->Dummy() returns "A null reference pointer was passed to the stub."

    ATL / WTL / STL c++ com windows-admin tools help

  • Convert LPWSTR to LPSTR
    A ajitatif angajetor

    Hi everyone, I need to convert a unicode LPWSTR to multi-byte LPSTR.wcstombs_s doesn't do good,because it replaces non-english characters to their english likes (like ş->s and ı>i). WideCharToMultiByte function seems to do this right,but the double-byte characters in the converted LPSTR are interpreted as if they are two single-byte characters. to be more specific,I use MAPI dll to send an e-mail.MAPI dll expects all strings to be LPSTR which maps to int.but i want to use non-english characters in e-mail's body/subject/attached files' names,and couldn't find a solution yet.it's all good when strings are in english,because all unicode characters map to a signed char then.but when i get a non-english character,"problem".LPSTR seems to interpret all characters to be single-byte. any suggestions?

    C / C++ / MFC help question

  • Displaying a ToolTip
    A ajitatif angajetor

    uh,i had to hack my code much more throughly to see it was all about rectangles.i found out that the toolbar had one of the items resized after i created the tooltip (with the wrong rectangles). and i added a TB_SETTOOLTIPS message right after the TTM_ADDTOOL.works just fine now,thanks for everything :)

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