|
A much simpler way would be to store it in the file's resource table. See this article for ideas.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thank you very much...
I will try using the resource because putting the password in another file wont work for my program...
Well... I am a beginner ...
|
|
|
|
|
Well, i made a MFC project with Automation, i called it COMDialog, and i want it to send arrays of data to another "client" application. But when i try to make method with SAFEARRAY parameter it says that parameter type must be variant compatible. How to make it? And i noticed that MFC project with automation ability is not fully COM application isn't it?
|
|
|
|
|
Hello Rassul,
Try using VARIANT as the parameter type. Then use V_ARRAY macro to access the safearray.
Hope this helps,
Bio.
|
|
|
|
|
Now I need to response to the rotating of my screen.
that is , an application made by third-party rotates the screen in a
random time, when the screen rotates, I need to do sth.(like pop up a
message box).
I think I can use a work thread to monitor the changes on screen.
but how can I know whether the screen rotated?
thanks.
|
|
|
|
|
Hummm .. a possible way is to check for the screens Dimensions (if that applies)
at time x .. 1024 x 768
at time y .. 768 x 1024
think it could apply ?
|
|
|
|
|
darkbyte:
Thanks for your reply.
To check if the dimemsion changes can work when the screen rotates 90 degree or 270 degree(and it's hard to know whether 90 degree or 270 degree).But when I rotates 180 degree, I dont know what to do.
like:
1024 x 768 ------ 0 degree or 180 degree
768 x 1024 ------ 90 degree or 270 degree
How to deffer them if they are the same dimension?
|
|
|
|
|
I am using Install Shield Express 5.0 to create an installation wizard for my application. My application requires 3DChartM.ocx file to be registered in windows registry which will be there in the C:/winnt/system32 directory.
How to I include windows registry information into my installation wizard so that user need not manually register it. When he runs the setup it should take care of registering the ocx file also. But i am unable to do this.
Please let me know if anybody knows about this.
vidya
|
|
|
|
|
You should create a file group in InstallShield and set that group to Self Registered. Then, in Script, you must call few commands to register such ocx files. See help for more information
|
|
|
|
|
thank you ....now it is working for me..
i set the properties of the file 3DChartM.ocx as self registered.
Now it is registered and working fine,
Thanks
vidya
|
|
|
|
|
I am developing an application for embedded XP using VC++ 6.0 as the development env. Since the UI is touch screen based i need to display the soft keyboard for text input.
Can Any one tell me the Win API to display the keyboard and to customize it what all i have to do..
The Similar API are available for WinCE development..E.G. SipShowIM();
Thanks And Regards
Amit
|
|
|
|
|
I am not sure there is one outside of the WinCE stuff. However it is relatively simple to produce one. You just need an array of buttons that map to the associated keys. Or some other alternative.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Thanks for ur reply.
What about Multilanguage support..
Amit
|
|
|
|
|
Hi All,
I'm not wonderfully experienced in COM programming.
I've written an app which captures video frames from a DV Camcorder to a file (in a proprietary format). It works well, which is nice.
In essence, I am:-
1. Creating an IGraphBuilder and an ICaptureGraphBuilder2
2. Adding the MSDV filter for the camera & adding an ISampleGrabber.
3. using the ICaptureGraphBuilder2 to build the filter graph.
So, in step 3, ICaptureGraphBuilder2 is adding some extra filters to the graph to complete the chain (in fact, it adds a Smart Tee, DV Decoder, and a Video Renderer.
My confusion it that i'm unsure on how i should be cleaning up when i'm finished.
I can Release() the pointers to the interfaces that I created, but what about the filters that ICaptureGraphBuilder2 created? will they be released automatically when I release the IGraphBuilder ?
Or, should I enumerate all the filters in the graph and IFilterGraph::RemoveFilter() them?
Are there any tools available that can list instances of COM objects that I create, and spy on their reference counts?
Thanks for any info
JOn
#include <beer.h>
|
|
|
|
|
Jon Hulatt wrote:
Are there any tools available that can list instances of COM objects that I create, and spy on their reference counts?
The easiest way is by inspection of the value returned by release - however remember that functions that correctly obey the rules of COM will AddRef / Release depending on the parameter type (for example adding a filter to a graph is an [in] parameter which will force an AddRef), so you'll have to compensate for this when you look at the values.
However, if possible, you don't want to be doing this. COM, and especially DirectShow are hideously frustrating beasts to cleanup (as I'm sure you've found out ), so much so that you really don't want to have to.
Where possible use smart pointers which abstract away the intricies of calling AddRef and Release. The two most obvious starting points are boost::shared_ptr (which will need a custom delete function) or the CComPtr / CComQIPtr classes provided as part of ATL.
One of the other things I've learnt from experience is that when DirectShow applications start to fall over, they do it in a really big way. Make sure that each operation that you complete can be rolled back. This becomes fairly nasty if something throws an exception - the only solutions I've found for this is to use RAII for each operation (for example adding filters or connecting pins) that you complete on a graph.
* Create the graph and DirectShow interfaces
* Create Filters
* Add the filters to the graph
* Set the properties for the filters in the graph (this step may need to be repeated / delayed until after having connected the pins of the filters)
* Connect the pins for the filters (I do this manually to avoid the chance that DirectShow will insert intermediate filters in stupid places)
* Start the graph
Do the operations for your application
* Stop the graph
* Disconnect the pins of the filters
* Remove the filters
* Destroy the filters
* Destroy the graph and DirectShow interfaces
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Thanks for the pointers; i'll try them out. Hopefully it'll make things work a bit better!!
Regarding destruction of filters that DirectShow adds automatically; do you know if when you Release() the graph, DirectShow will Release remaining filters it holds a reference too?
Or, does it only Release() when filters are removed from the Graph?
Thanks!
Jon
#include <beer.h>
|
|
|
|
|
I'm not 100% sure, but I don't believe it does. I tend not to give it the chance to try - if you force it to do exactly what you want there is less chance of something going wrong. Running in debug should tell you if there are any unreleased COM objects lying around if you want to check.
IMO It's just as easy to manually remove the filters when you're done.
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Dear all
i want to use the "Print to file" windows functionality in my win32 SDK (No MFC) application. Is there any way i can do it? Also i want that no dialog boxes should be display as it appears in windows print dialog box.
____________________________________________________________
rishabhs
I think therefore I am.
|
|
|
|
|
If I had a very simple program which was spread over two projects, e.g.
Project 1 called "print" containing print.c:
#include <cstdio>
extern void printsomething();
void main (void)
{
printsomething();
return;
}
Project 2 called "printsomething" containing printsomething.c:
#include <cstdio>
void printsomething();
void main (void)
{
printf("Hello world! from printsomething main.\n");
return;
}
void printsomething ()
{
printf("Hello world!\n");
}
... where the "printsomething" is a dependancy of "print" why don't they link to produce the "print.exe".
|
|
|
|
|
Hi,
In XP OS, if we open more than one application instance (2 - 3 word instances), in the taskbar, toolbar button goes in group button(dropdown button), if we right click on the toolbar button, it will display the menu (cascade, tile horizontally, minimize group, close group). I need to find out the exe name (winword.exe), when I right click on drop down toolbar button. Is it possible please help.
Thanks in Advance
|
|
|
|
|
HWND hwndShell = FindWindow(TEXT("Shell_TrayWnd"), TEXT(""));
HWND hwndReBar = FindWindowEx(hwndShell, NULL, TEXT("ReBarWindow32"), TEXT(""));
HWND hwndMsTask = FindWindowEx(hwndReBar, NULL, TEXT("MSTaskSwWClass"), TEXT("Running Applications"));
HWND hwndToolBar = FindWindowEx(hwndMsTask, NULL, TEXT("ToolbarWindow32"), TEXT("Running Applications"));
here u've a sample to retrieve window handle of the toolbar where your group belong to.
this group is only a button.
so now u should use toolbar functions to retrieve specified info. i think in case u've to get selected item. or handle oncontextmenu.
4apai
There're no impossible tasks. There're tasks that required infinite period of execution time.
|
|
|
|
|
|
Hello to all!Hope anyone could figure out my problem... i have a program in VC++ 6.0(w/ sp6) and created a Release version... i have compiled and it runs in my pc so well. So i think i will have no problem distributing it to another pc. When i distribute the Released Exe, the program cannot proceed, just the login session and then it exits... when i try to traced the error, i found that i having trouble with _CommandPtr->ActiveConnection. here is the code snipet..
void CBPLSAssessmentApp::AuditTrail(CString MCode, CString ATable, CString DObject)
{
CBPLSAssessmentApp *pApp = (CBPLSAssessmentApp*)AfxGetApp();
CString sQuery,sCurrentDate;
COleDateTime m_vodtMonth,m_vodtDay,m_vodtYear,m_vodtSaveTime;
_RecordsetPtr pRSet = NULL ,pRights = NULL;
_CommandPtr pCmd = NULL;
try // CTS 02022004 add try and catch
{
pCmd.CreateInstance(__uuidof(Command));
pCmd->ActiveConnection = m_pConnection; // <-- this is the culprit
sQuery = "insert into a_trail values ";
sQuery+="('"+ SetStrLength(sUser,10) +"',";
//m_vodtSaveTime = COleDateTime::GetCurrentTime();
m_vodtSaveTime.ParseDateTime(GetSystemDate());
sCurrentDate.Format("%04d-%02d-%02d %02d:%02d:%02d",
m_vodtSaveTime.GetYear(),
m_vodtSaveTime.GetMonth(),
m_vodtSaveTime.GetDay(),
m_vodtSaveTime.GetHour(),
m_vodtSaveTime.GetMinute(),
m_vodtSaveTime.GetSecond());
sQuery+=" '"+sCurrentDate +"',";
sQuery+=" '"+ SetStrLength(MCode,10) +"',";
sQuery+=" '"+ SetStrLength(ATable,30) +"',";
sQuery+=" '"+ SetStrLength(m_sComputerName,30) + "',"; // JJP 10112003 for Manila Workstation
sQuery+=" '"+ SetStrLength(DObject,200) +"')";
pCmd->CommandText = _bstr_t(sQuery);
pCmd->Execute(NULL, NULL, NULL);
}
catch (_com_error &e)
{
_bstr_t bstrDescription(e.Description());
MessageBox(NULL,LPCTSTR("CBPLSAssessmentApp:AuditTrail\n"+bstrDescription),APP_NAME,MB_OK);
exit(1);
} // CTS 02022004 add try and catch
}
as you notice, i have a try and catch but when i run the program... its passes through but no values is being catched...
can anyone figured it out?
|
|
|
|
|
My guess would be that the pCmd.CreateInstance(__uuidof(Command)); is failing, and so your (smart) pointer is NULL when you dereference it on the next line. This will not give a COM exception, but probably an access violation (0xC0000005), which is not being caught.
I would suggest testing pCmd after the CreateInstance , and also adding in a catch(...) block, and see what exception (if any) is caught there.
|
|
|
|
|
Graham Bradshaw wrote:
I would suggest testing pCmd after the CreateInstance, and also adding in a catch(...) block
how can i test for the _CommandPtr? i already catch it but no access violation or com exception has been produced... i also compiled my program in another computer and then transfer the exe to another computer and it works very well... so i think my computer has a problem about the msado15.dll where database pointers originates.... ive test and compiled it in 2 different computers and distribute the exe and its running fine... but then again, i tried once more to my computer and it fails... is there a possibility to overwrite my msado15.dll? how can i know if im using the right dlls for ado connections?
|
|
|
|