|
does anyone know a class for beginners to get samplerate bitrate and time of a mp3?
|
|
|
|
|
|
Hi All
I'm trying to return a string from a dll to VBA as a BSTR but the variable always returns a null. What am I doing wrong? Are the variables passing out of scope before the result is returned?
<br />
#include <wtypes.h><br />
#include <oleauto.h><br />
#include <string><br />
<br />
BSTR __stdcall SomeFunction(LPSTR cSPC)<br />
<br />
CHAR cTheString [255];<br />
BSTR bResult;<br />
UINT iStringsLength=0;<br />
<br />
strcmp(cSPC,"Absolute Return");<br />
<br />
iStringsLength = strlen(cTheString); <br />
bResult = SysAllocStringByteLen(cTheString,iStringsLength);<br />
<br />
return bResult;<br />
}<br />
The project builds, links and compiles successfully. Any thoughts about the problem would be gratefully accepted.
Regards
Jeremy
|
|
|
|
|
Your code post has got mangled up, but I have two comments. I don't see anywhere in your code that an assignment of a string of characters takes place to the variable, cTheString. Thats probably why no string shows up in your BSTR. I don't know a lot about BSTR types, but since you are making a call to SysAlloc.. to create the BSTR, I would seem to me that there must be a call to SysDealloc.. somewhere or the BSTR is going to leak. Just my musings. Try using the <pre> and </pre> tags to show your code better.
Chris Meech
I am Canadian. [heard in a local bar]
Remember that in Texas, Gun Control is hitting what you aim at. [Richard Stringer]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
|
|
|
|
|
Sorry Chris - I copied out part of the code incorrectly here is what it should have been - Thanks Jeremy
BSTR __stdcall SomeFunction(LPSTR cSPC)
CHAR cTheString [255];
BSTR bResult;
UINT iStringsLength=0;
strcpy(cTheString,"Absolute Return");
iStringsLength = strlen(cTheString);
bResult = SysAllocStringByteLen(cTheString,iStringsLength);
return bResult;
}
|
|
|
|
|
I have an application where some structures are packed. Does anyone know what the advantage is in packing a structure, why it is used, pros/cons, etc.?
Thanks,
Jerry
|
|
|
|
|
Pros: Uses less memory / disk space
Cons: More confusing to work with
--
Help me! I'm turning into a grapefruit!
Buzzwords!
|
|
|
|
|
A packed structure saves memory at the cost of less-efficient code. Some CPU's access memory more efficiently on 4, 8, or 16 byte boundaries. Struct's packed on those boundaries can be accessed more efficiently.
If you need your program to process an existing data stream, you may have to set the structure packing to match, so that your compiler doesn't add filler bytes between structure members. For example, suppose the following is the form of a network message:
struct Message {
unsigned short Length;
char Data[128];
}; If the compiler's default packing is 4, you could miss the first two characters of the data, since it would add two filler bytes following the Length member in order to align the Data member on a four byte boundary.
Software Zen: delete this;
|
|
|
|
|
The project I code for is a cad software.. in which I have a dilog box dlgmain
--------------------------------------|
Dlgmain(title bar)----------------|
--------------------------------------|
-------\--------\---------------------|
TAB1-\TAB2-\--------------------|
---------\---------\------------------|
(*)radio1--------|------------------|
-------------------|-<-button1>---|
-------------------|------------------|
#<button1-->--|-----------------|
-------------------|------------------|
___________ |------------------|
-------------------------------------|
-------------------------------------|
% represents space (nothing ness)
Now I will explain the figure up there , the button1 with a # symbol before was in
the tab control , doing a specific functionality of looking up the constraints like radio button etc and get to the drawing in the window behind this dlg(obviosly i could not draw that), and do the operation and get back or complete.., now I have taken that button from there to the dlgmain control , which has shifted its class , now I want to shift the button 9 so that it is available for all tabs) and have the same functionality ,
Now the real problem is the code for #button1 is in Tab.cpp (tab class) , which is obviosly and afx_msg protected and non-static , so not accessible to any other class's member functions , so even if I create a public member function with that code and try to access that it gets accessed but does not do anything (and forget about what it used to do earlier)..
I tried to get the data which it is trying to execute and then use that data to execute new buton1 which is getting clumpsy and almost writing the entire tab functionalities into this class ,
if I use inheritance , both are derived from the same class CDialog,, so I don't know how to make it virtual and stuff , i tried and failed
so anyone can sort this out that would be really really great of you
If you think this post is not at all understandable (that is because of the company policy I cannot take screen shots and send ) ..
Thank you if you went through the whole thing
|
|
|
|
|
Sorry.. I can't speak English..
I wish Flash to playing on DialogBox..
I thinking... Shockwave Flash Object ActiveX contol ..
How use Shockwave Flash Object and CShockwaveFlash class ?
I wish .. detail explanation..
^^v
|
|
|
|
|
Hi all,i have a string,and now i really want to check whether it is a float or not. And how to know a number is a float or an integer?
Can you have me guy?Thanks in advance!
|
|
|
|
|
you could test if ::floor(number) == number , which would mean that even truncated, you number remaids the same (so, is integer)...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Thank you,but if i have a string,i.e : "jry1924",how to check whether it is a number or not?
I tried using function atof but if your string is not a number,it returns 0.
Help me pls!
|
|
|
|
|
The only verification that you can do is check if there's a , or . (depending on how you represent floating points numbers ) in the string, between 2 numbers, if it's the case, you can deduce it's a float.
for exemaple
CString sNumber ( "123.123" );
could/would be a float.
but
CString sNumber ( "123123" );
can either be an integer or a float.
or you could use atof and related functions, or maybe sprintf , check the documentation of those functions.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
however, you also have to test, even if there is a , or a . , if the string is a valid number.
consider the string "3..2.4" ... not really a number isn't it ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct is rit or u can check it this way also
std::string str = "123.45";
int pos = str.find(".");
if(pos == -1)
cout<<"It's int"<
|
|
|
|
|
Hi,
Recently, one of our customers reported a strange problem with our software. It happened so that due to some problem in the power to the computer, the power supply (SMPS) of the PC got damaged. After rectifying the fault, he started using our software, and reported that our application crashes at various locations where it worked fine before. When I check the exception being raised, it says float point division by zero exception. Now all of sudden at various places in my code where I use division (for e.g., progress bars) the application fails there.
Could anyone suggest what could have gone wrong and how to fix it?
Thanks,
Krishnan
|
|
|
|
|
Definately sounds like a hardware problem,
have a quick read of this[^],
|
|
|
|
|
How can I constrain the mouse movement to a rectangle? I remember there is a windows function for that but I do not know it.
Thank you !
modified 9-Mar-17 17:22pm.
|
|
|
|
|
|
With OLE DB CONSUMER, how can i execute a parameterized or not stored procedures and queries ? Using Visual C++
I am learning my self
|
|
|
|
|
In a project I am working on I am using a legacy DLL. I have created an MFC Dll project that is using MFC as a shared DLL and is also using the legacy DLL. The project compiles fine. Then I created a Console application to use the DLL and an assertion "Debug Assertion Failed" in the file: "afxwin1.inl" was thrown. When running the same Dll from an MFC Windows application the assertion doesn't appear. How can I overcome this problem?
|
|
|
|
|
ikasovitch wrote:
...and an assertion "Debug Assertion Failed" in the file: "afxwin1.inl" was thrown.
What line fired the assertion?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
The line 19 fired the Assertion
|
|
|
|
|
Which indicates that AfxGetInstanceHandle() is being (indirectly) called but afxCurrentInstanceHandle is NULL . Are you using AFX_MODULE_STATE ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|