|
hi, it's possible to create a file in ram and accessing it with fopen/fread funcion?I've got some libraries that works on an mp3 file and I need them to work only on first 30 seconds, since they work on file stream and ends when EOF is reached I tought to create a file, copy first 30 seconds into and work in ram as it is a real file, but I don't know how... thanks
Paolo
|
|
|
|
|
Check the memory mapped files
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
As Papa mentions check out memory mapped files - but you will need to use the Win32 read/write calls not fread/fwrite. You'll need to use ReadFile/WriteFile using the file handle that you get back from creating the mem mapped file. Check out CreateFileMapping (I was curious about this too ) and it's related functions on MSDN.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
thanks to Papa amd Jim, but I've lib code that uses fread/fopen ( for portability iusse), so I can't use Win32 API, I think I'll copy the file into a new one on HD and then delete it after my works on it, thanks
bests
Paolo
|
|
|
|
|
How do use lib file. Do i just have to declare the lib name in the link tab. How do i get the function names that are exposed by the library??
|
|
|
|
|
Instead of putting it in the link tab, you can also use:
#pragma comment(lib, "libfile")
I suppose, if you have the DLL of the LIB file, you can view the dependencies from the "Depends" Visual Studio tool. It will list the functions exported.
Hope this helps.
* Don't wish it was easier, wish you were better! *
|
|
|
|
|
Actually the project did not make any dll file....i have the complete code for the lib project. The project compiles ok no errors there. Only when i add the lib file to the project and try to call the global function for that lib then i get loads of unresolved symbols errors. Any ideas how to deal with this or what i am doing wrong here.
Thanks
|
|
|
|
|
FASTian wrote:
...i get loads of unresolved symbols errors. Any ideas how to deal with this or what i am doing wrong here.
The exported function is not being called correctly. Make sure C++'s name mangling is not biting you.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I'm curiuos about this too. Could you expound upon "name mangling" and how to avoid it?
|
|
|
|
|
Try this search.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hey everybody,
I'm hoping more people can shed some light onto my font problem that I discussed in an earlier post.
Our application has a drawing area where the user can assign font type and size to a particular object. We're currently storing the logical units for the font, is this a bad thing? Will this display the same on all output devices (printer/screen etc)?
To me it seems like its better practise to store the actual point size, what's the dis/advantages of each and why? anyone?
Mike.
|
|
|
|
|
The only thing I would say is that dealing with fonts and a point size is usually much easier as you can get the actual point size for any given DC (be it printer or screen etc) using:
size = -MulDiv(pointSize, pDC->GetDeviceCaps(LOGPIXELSY), 72);
With logical coordinates you probably have to go through another translation first.
Also, it may depend on what DC mapping mode you are using.
Roger Allen - Sonork 100.10016
Strong Sad: I am sad I am flying
Who is your favorite Strong?
|
|
|
|
|
Hello! i have a small problem
in my thread class (called CHilos) i declared as a member variable:
[CODE]
struct Param {
HWND *ventana;
CHilos *hilo;
} *param;[/CODE]
and in my thread 'begin' function i have:
[CODE]
void CHilos::Comenzar(LPVOID lParametro)
{
DWORD handle;
param->ventana = static_cast<hwnd *="">(lParametro);
param->hilo = this;
CreateThread(NULL,0,CHilos::ThreadProc,(LPVOID)param,0,&handle);
}
[/CODE]
and i get a runtime error in both param-> lines. In the createThread i used to pass this instead of param.
[CODE]CreateThread(NULL,0,CHilos::ThreadProc,(LPVOID)this,0,&handle);[/CODE]
what am i doing wrong?
thanks!
|
|
|
|
|
param = ??
param is a pointer to a struct Param, meaning its pointing to a struct param, but which one?
you do have something like this?
Param xParam = {0};
param = &xParam;
or maybe like this?
param = new Param;
or again like this?
param = (Param*) calloc (1, sizeof(Param));
in the last two case dont forget to delete (for new), free (for calloc) respectively when you are done using the param (thread end?).
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Change:
<small>kfaday wrote:</small><br />
DWORD handle;<br />
param->ventana = static_cast(lParametro);<br />
param->hilo = this;
to:
DWORD handle;<br />
Param *pNewParam = (Param *) lParametro
Now you can access your members with pNewParam !
* Don't wish it was easier, wish you were better! *
|
|
|
|
|
thanks to both of you!!
i should have came up with that!
|
|
|
|
|
HI,
PLZ tell me how can i place JPEG , GIF or BMP as a background on dialog ..
Actualy i want a beautifull background of my application (MFC Dialog Based)
if any source code or help
i not wana a use ACTIVEX ..
thanx
|
|
|
|
|
Just query for 'skin' in your article search and you will see tons of it. From dialogbox to combobox.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Actualy i have my own made JPEG ,BMP, GIF..
and i want to use these a background
and i want to place controls like button , combos etc on that background
|
|
|
|
|
How can i get the locale system time and date?
Can u give some examples?
Please help me..
Thanks everybody...
|
|
|
|
|
Try this, a simple one (MFC)
CTime t = CTime::GetCurrentTime();
struct tm* osTime;
osTime = t.GetLocalTm( NULL );
ASSERT( osTime->tm_mon == 2 );
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
i hope following will help u
CTime stime = CTime::GetCurrentTime();
CString s = stime.Format("%A, %B %d, %Y,%I:%M : %S :%p" );
AfxMessageBox(s);
chk it
take care
|
|
|
|
|
Hi,
I try to use Script Control OCX in VC++ 7.0
i can do that.My problem is that i want to just compile script file by using AddCode method.But it is do compile and run script code.how can i disallow running script:
if (m_TargetEngine == CLSID_JScript)
{
m_ScriptControl.put_Language("JScript");
}
else
{
m_ScriptControl.put_Language("VBScript");
}
m_ScriptControl.put_State(0);
UINT column = 0;
UINT line = 0;
UINT Number;
CString Description;
CString Source;
CString Text;
try
{
//it is also do run but i dont want it do that
m_ScriptControl.AddCode(strCode);
}
catch (...)
{
LPDISPATCH lpdisp = m_ScriptControl.get_Error();
DISPID dispid;
OLECHAR* name = L"Column";
CComVariant result;
HRESULT hr = lpdisp->GetIDsOfNames(IID_NULL,&name,1,GetUserDefaultLCID(),&dispid);
DISPPARAMS params = {NULL,NULL,0,0};
hr = lpdisp->Invoke(dispid,IID_NULL,GetUserDefaultLCID(),DISPATCH_PROPERTYGET,¶ms,&result,NULL,NULL);
column = result.iVal;
name = L"Line";
hr = lpdisp->GetIDsOfNames(IID_NULL,&name,1,GetUserDefaultLCID(),&dispid);
hr = lpdisp->Invoke(dispid,IID_NULL,GetUserDefaultLCID(),DISPATCH_PROPERTYGET,¶ms,&result,NULL,NULL);
line = result.iVal;
name = L"Description";
hr = lpdisp->GetIDsOfNames(IID_NULL,&name,1,GetUserDefaultLCID(),&dispid);
hr = lpdisp->Invoke(dispid,IID_NULL,GetUserDefaultLCID(),DISPATCH_PROPERTYGET,¶ms,&result,NULL,NULL);
Description = CComBSTR(result.bstrVal);
name = L"Source";
hr = lpdisp->GetIDsOfNames(IID_NULL,&name,1,GetUserDefaultLCID(),&dispid);
hr = lpdisp->Invoke(dispid,IID_NULL,GetUserDefaultLCID(),DISPATCH_PROPERTYGET,¶ms,&result,NULL,NULL);
Source = CComBSTR(result.bstrVal);
name = L"Number";
hr = lpdisp->GetIDsOfNames(IID_NULL,&name,1,GetUserDefaultLCID(),&dispid);
hr = lpdisp->Invoke(dispid,IID_NULL,GetUserDefaultLCID(),DISPATCH_PROPERTYGET,¶ms,&result,NULL,NULL);
Number = result.iVal;
name = L"Text";
hr = lpdisp->GetIDsOfNames(IID_NULL,&name,1,GetUserDefaultLCID(),&dispid);
hr = lpdisp->Invoke(dispid,IID_NULL,GetUserDefaultLCID(),DISPATCH_PROPERTYGET,¶ms,&result,NULL,NULL);
Text = CComBSTR(result.bstrVal);
CString strResultFormat;
strResultFormat.Format(_T("Line[%d] Column[%d] %d>> %s %s (%s)"),line,column,Number,Text,Description,Source);
m_TaskList.AddString(strResultFormat);
}
|
|
|
|
|
Hi,
I am unable to simulate Extended ASCII characters from 127 to 254 through keybd_event()function.
keybd_event(0x9A, 0, 0, 0); //0x9A IS HEXA VALUE OF extended ASCII char(154)
keybd_event(0x9A, 0, KEYEVENTF_KEYUP, 0);
/* The below mentioned code has not take any effect
keybd_event(0x9A, 0x45, KEVENTF_EXTENDEDKEY|0, 0);
keybd_event(0x9A, 0x45, KEVENTF_EXTENDEDKEY| KEYEVENTF_ KEYUP, 0);
the said code is delimited by default keyboard driver loaded in microsoft word and not sending message to Word or Excell application in WPARAM wparam (wparam is only using the Virtual keys in keyboard, which is already defined).
*/
keybd_event(0x9A, 0, 0, 0) ;
keybd_event(0x9A, 0, KEYEVENTF_KEYUP, 0) ;
code has not been produce the character "Ü". I want to access the Extended ASCII char codes 127-128. and the character sets should be transmitted to wparam (parameter) in SetWindowsHookEx() function.
I am also having a doubt, whether the wparam (parameter) may how modified in messages i.e. pMsg->(). and how to load the Unicode driver in VC++ programs for accessing the Extended characters.
If any idea or little bit of code available, I will oblige.
Thanking you.
by KKSM
|
|
|
|
|
I think your codes should be written as
keybd_event(0x154, 0, KEYEVENTF_EXTENDEDKEY, 0)
instead.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|