|
hello,
Suppose I am developing an application in VC++ which helps in modifying data in excel.
For doing so I use COM components to get connected to excel and add a sheet etc.
But Suppose I have written a program in VC++ which uses pointers and I want to use the program in VB then will I be able to run my methods written in VC++ from VB
Prithaa
|
|
|
|
|
If your VC++ app is a COM server then you can access from VB.
Cheers,
Suresh
|
|
|
|
|
Hello,
Thanks for your reply.
But even if VB does not support pointers and references can I use COM. I don't know whether VB supports pointers .But if it doesn't then in my COM classes I should not use pointers.Is it?
Prithaa
|
|
|
|
|
VB doesnt support Pointer, however you can use COMponents which use pointers in their code.
As we all know COM is a binary standard, you are basically re-using the binary code not the C++ source code.
Cheers,
Suresh
|
|
|
|
|
Hello,
Thanks for your reply.
Is there any link to elaborate your point.
I have sort of undestood.
Prithaa
|
|
|
|
|
|
Hi, I currently have bitmaps coming in as files from a usb input and I'm wondering what library is suitable for displaying the bitmaps into a video. If so can someone point me in the right direction?
Thanks
|
|
|
|
|
If you just want to display them as a video then you can draw the bitmaps to a window as they
come in.
If you want to save a video file then you'll need to know the file format, and if it's a compressed
format, how to compress the images into a video stream.
For free, if Windows Meda Format is acceptable, you can use the Windows Media Format SDK[^]
to write an image stream to a Windows Media Video (WMV) file.
There's lots of third party stuff available I'm sure, but I've never used any.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thanks for the hints.
I've heard DirectShow can also be a relevant library, or is that mainly for displaying video?
|
|
|
|
|
DirectShow will work. The only problem I see with that is that there's no source filter available
to dump images into so you'd need to develop your own. Otherwise it would be similar to using
Windows Media Format. In fact, besides AVI, Windows Media (with MPEG-4) is the only included
way of writing files. Windows Media Format would be simpler than adding an extra layer on top
of it.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Which version of the Windows Media SDK do you recommend, or should I use the latest (version 11)?
Thanks
|
|
|
|
|
I suppose the latest one (11) is fine. I'm still on 9.5 for no other reason than I haven't used
any of the newer DRM stuff in 11 and I haven't installed it. Maybe today if I'm bored
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi,
I am trying to get IID_IHTMLElement but its failing, in few cases. The GetlastError function returns 0 for these cases.
I am using following function call to achive this,
IHTMLElement * pElement = NULL;
IHTMLDocument2 * pHTMLDoc = NULL;
HRESULT hr;
IServiceProvider * pSP = NULL;
hr = pAccWindow->QueryInterface(IID_IServiceProvider, (void **)&pSP);
hr = pSP->QueryService(IID_IHTMLElement, IID_IHTMLElement, (void **)&pElement);
I do not get any exception, bur I getting pElement as NULL.
I got these failure when I press the Browser BACK button in MSIE 6.0.
Any pointer will be helpful,
Thanks in Advance
ARLahare
|
|
|
|
|
Abhi Lahare wrote: The GetlastError function returns 0 for these cases.
You need to diagnose the HRESULT
led mike
|
|
|
|
|
Return value is E_INVALIDARG
but not sure what is wrong with input parameter.
Regards
ARLahare
|
|
|
|
|
According to the docs, the object "can be an element or a window".
Have you tried querying for IID_IHTMLWindow2 first as documented?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
Without knowing anything about this, I did a quick SDK search. This sample code (and similar
code found on Google) seems to be common -
HRESULT hr;
IHTMLWindow2 * pWindow;
IHTMLElement * pElement;
hr = pSP->QueryService(IID_IHTMLWindow2, IID_IHTMLWindow2,
(void **)&pWindow);
if (FAILED(hr))
hr = pSP->QueryService(IID_IHTMLElement, IID_IHTMLElement,
(void **)&pElement);
pSP->Release();
if (SUCCEEDED(hr))
{
assert( pWindow || pElement);
....
code here...
if (pElement)
pElement->Release();
if (pWindow)
pWindow->Release();
}
Maybe that helps?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
From my experience the IHTMLElement interface is not accessed via IServiceProvider but simply via QueryInterface on the element in question. GetLastError is not used for error handling in COM: COM is designed with remote access in mind and the GetLastError mechanism is thread specific. In your code what is pAccWindow ?
Steve
|
|
|
|
|
Thanks Stephen,
I have seen code samples where IServiceProvider is used to accesses IHTMLElement and its working in my code for other cases.
pAccWindow is the IAccessible pointer.
Thanks for your help
ARLahare
|
|
|
|
|
A problem became apparent when I tried to run an app I have that utilizing the Dropdown arrows for toolbar buttons in Windows Vista. I haven't had much luck in the Vista forum, so I thought I'd approach my issue from a different angle and entertain the idea that it might not be related to Vista and maybe just something I'm doing wrong. Maybe it's been working on previous systems out of pure luck.
(I don't want it to be a crosspost, but in case somebody asks, the problem on Vista was the buttons end up too big vertically to fit in the toolbar)
Anyway, here's what I am adding to my CMainFrame::OnCreate to get dropdown arrows. I am also adding text to the right of the buttons. I'll assume I'm just using the "new" button for demonstration.
Am I doing this part correctly in general (2000, XP, etc...)?
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
//...
if (!m_wndToolBar.CreateEx(this,TBSTYLE_FLAT|TBSTYLE_LIST,
WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_TOOLTIPS|
CBRS_FLYBY|CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
//...
m_wndToolBar.GetToolBarCtrl().SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS);
//...
m_wndToolBar.SetButtonStyle(m_wndToolBar.CommandToIndex(ID_FILE_NEW),
TBSTYLE_AUTOSIZE|TBSTYLE_DROPDOWN);
//...
m_wndToolBar.SetButtonText(m_wndToolBar.CommandToIndex(ID_FILE_NEW),"New");
//...
return 0;
}
|
|
|
|
|
Note: If you are not an expert on standard C++ or the STL, you may want to skip this one.
Restrictions:
1) Only standard C++ may be used.
2) Can not use ‘use_facet’ template, because that is not correctly defined by all suppliers (namely VC6.0).
3) Can not use any vendor specific extensions; like ‘_ismbtrail(…)’.
4) No knowledge of the code-page may be used.
I need to generate the missing characters in a range of multi-byte characters. My current implementation restricts sequences of characters to those with the same lead-byte, but I wish to eliminate that and ensure that no generated characters are invalid.
1) Example (Japanese: shiftjis):
Input range: Fullwidth digits “[0-9]” -> “[\x82\x4F-\x82\x58]”
Output sequence: “\x82\x4F\x82\x50\x82\x51\x82\x52\x82\x53\x82\x54\x82\x55\x82\x56\x82\x57\x82\x58”
That sequence is easy to generate because the lead bye is the same for all those characters and there are no gaps (invalid characters) in the sequence. The problem is that this places restrictions on the user – requiring them to know that all characters in range have the same lead-byte and that there are no gaps.
2) Example of lead-byte problem (Japanese: shiftjis):
Input range: “[\x82\xF1-\x83\x40]” -> [“Hiragana Letter N” – “Katakana Letter Small A”]
Output sequence: “\x82\xF1\x83\x40”
Unicode equivalent: “\x3093\x30A1”
In the above example it does not matter if a user is likely to enter that range, the code must be able to create the valid output sequence. As you can see the gap exists in both ShiftJis (MBCS) and Unicode.
3) Example (Japanese: shiftjis):
Input range: “[\x81\xE0-\x81\xDF]” -> [“Approximately Equal To Or The Image Of” – “Identical To”]
Output sequence: “\x81\xE0\x81\xDF”
Unicode equivalent: “\x2252\x2261”
In the above example both lead-bytes are the same, but there exist a gap of 16 invalid characters. This situation is easier to handle because I can actually use ‘mblen’ to check for valid 2-byte sequences, although I do not like this method.
4) Example (Japanese: shiftjis):
Input range: “[\xDF-\x81\x40]” -> [“Halfwidth Katakana Semi-voiced Sound Mark” – “Ideographic Space”]
Output sequence: “\xDF\x81\x40”
Unicode equivalent: “\xFF9F\x3000”
In this case the first character in the range is a single-byte (SB) character and the second is a double-byte character. Again it does not matter if a user is likely to enter that range; the code must be able to create the valid output sequence. Also note that the Unicode sequence is even worst than the ShiftJis sequence.
Note: All character sequences where retrieved from the ‘Character Map’ program and may not reflect the ‘locale’ sequence, which is part of the problem.
As you can see it is not a simple matter of incrementing the character as we would do in ASCII. There is no ‘istrail’ method in the standard and even if there was it may not be enough to solve the problem.
The following is the current implementation, which will only work for examples 1 and 3:
template<class StringType_>
void basic_regexp<StringType_>::insert_range(
string_set_type& c_set,
const string_type& s1,
const string_type& s2) const
{
if( s1.size() != s2.size() )
throw_char_range_error();
char_type lower = s1[0];
char_type upper = s2[0];
char_type leadbyte = 0;
if( s1.size() > 1 )
leadbyte = lower;
if( leadbyte )
{
if( lower != upper )
throw_char_range_error();
lower = s1[1];
upper = s2[1];
}
if( lower > upper )
throw_char_range_error();
string_type s;
for( ; lower <= upper; ++lower )
{
s.clear();
if( leadbyte )
{
s += leadbyte;
s += lower;
if( mb_len(s,2) != 2 )
continue;
}
else
{
s += lower;
}
c_set.insert(s);
}
}
I know of no algorithm that can solve the problems presented here. The solution must be similar in simplicity as the above implementation. I can envision a method to solve some of these problems, but it would be grossly inefficient.
If there is an example of a possible solution anywhere I would be interested.
Throw any ideas you may have at the problem, but please note that the restrictions are there to ensure portability. In other words it must be as usable as any STL implementation would be.
Thanks to any and all of those who may examine this problem, even if you can think of a solution worth posting.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
I don't understand the "No knowledge of the code-page may be used" part. The encoding (Shift-JIS, Big-5, etc.) defines which byte sequences are legal and illegal. If you can't use knowledge of the encoding, how can you tell which sequences are legal?
|
|
|
|
|
Michael Dunn wrote: how can you tell which sequences are legal?
There are two functions that can be used to determine that: isleadbyte and mblen .
Michael Dunn wrote: I don't understand the "No knowledge of the code-page may be used" part.
I added that restriction because I feel that it should be doable without that knowledge. For instance, I do not need that knowledge in order to determine if the bye is a lead byte or to determine if 2 bytes represent a single multi-byte character. There should be enough information buried in the STL some where to allow me to ignore the current code page.
That being said, I do have some C code (written for Win 3.1) designed to handle some MBCS code pages given the code page number. The code pages covered are Shift-JIS, Big-5, Korean, and etc…, which would be easy to convert to my current requirements.
The given code is the only place in the entire project where the knowledge is required and I did not want to have to provide code page specific code. I wish there was more support built into the standard for handling multi-byte, because I do not like having to fall back to functions defined in the C standard.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
hey I'm programming a moving model and wow it worked up to some degree.
Now I'm facing a problem that drives me MAD!
I split the model into nodes to traverse them. each node has different attributes:
<br />
class node<br />
{<br />
public:<br />
Vector pos;<br />
Vector rot;<br />
Vector orot;<br />
node *child;<br />
node *sibling;<br />
<br />
float animationStartTime;<br />
...<br />
};<br />
well actually thats not too important.
I'm traversing each node with a special function TraverseNodes:
<br />
void Model::TraverseNodes(node _node)<br />
{<br />
glPushMatrix();<br />
if (_node.animated)<br />
_node.animate(gettime);
<br />
TransformNode(_node);<br />
DrawNode(_node);<br />
<br />
if (_node.child != 0) TraverseNodes(*_node.child);<br />
glPopMatrix();<br />
}<br />
the marked line makes trouble! in this function I change the value of "float animationStartTime". It works the node's attribute is set correctly but when I leave the TraverseNodes-function the attribute of the node is reset (I can see it during debugging).
Why is the local variable changed (temporarily) but not overwritten?
thx in advance
|
|
|
|