October 08, 2004

WMF Compiler Setting

You solve below problem with set configuration. in first step press Alt+F7 and then configured with below 3 steps.

????.obj : error LNK2001: unresolved
external symbol _WMCreateWriter@8
Debug/????.exe : fatal error LNK1120: 1 unresolved externals

راستش بعد از اینکه مشکلم حل شد تازه
یادم افتاد که هنوزم درست و اصولی برنامه نویسی نمی کنم ...
برای رفع این مشکل باید Visual Studio و پروژه مزبور رو Configure کنیم.
راهنمای تنظیم اون در این آدرسه
Windows Media Format SDK > Programming Guide > Getting Started > SDK Library Files and Compiler Settings
برای رفع این مشکل برید تو Settings از منوی Project و سپس این جاها

1) C/C++ > Category = Code Generation > run-time library > Debug Multithreaded DLL
2) Link tab > Category = General > Ignore all default libraries > check box
3) Link tab > Category = General > Object/library modules > Msvcrtd.lib, Wmvcore.lib

توجه کنید که در مورد 1 اگه پروژه به صورت Release داره Configure می شه به جای Debug Multithreaded DLL از Multithreaded DLL استفاده شود.
توجه کنید که در مورد 3 Libc.lib یا مشابه هاش رو add نکنید.
راستی اگه پروژه یهو 160~170 تا error داد نزنین تو سرتوون ... احتمالا تو Link tab > Category = General یه گونی lib دیگه add کرده بودید .. پس کافیه اون چک رو تو گزینه 2 بردارید.
حل شد ... خب خدا رو شکر .. لذتشو ببیرید.
البته اگه بخوام راستشو بگم خودم بجای همون 2 تا تمام این زیری ها را به LIB اضافه کردم.
quartz.lib winmm.lib msacm32.lib olepro32.lib strmiids.lib Wmvcore.lib

September 26, 2004

access to the path is denied

For solve below problem you can go to C:\Inetpub\wwwroot\[Project Name] and select your file and then right click on that (your file) and select properties from menu.After that you can go to Security tab page and select Users([your computer name]\Users) from "Group or user names" and then check the "Write" at the "Permissions for Users". I hope this helps.
Server Error in '/Project01' Application.
--------------------------------------------------------------------------------
Access to the path "c:\inetpub\wwwroot\Project01\?????.xml" is denied.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Access to the path "c:\inetpub\wwwroot\Project01\?????.xml" is denied.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
Line 79: // Write the new DataSet with the new name and password to the XML file.
Line 80: fs = new FileStream(Server.MapPath("?????.xml"), FileMode.Create, FileAccess.WriteFileAccess.Read);
Line 81: StreamWriter writer = new StreamWriter(fs);
Line 82: ds.WriteXml(writer);
Source File: c:\inetpub\wwwroot\Project01\adduser.aspx.cs Line: 80
Stack Trace:
[UnauthorizedAccessException: Access to the path "c:\inetpub\wwwroot\Project01\?????.xml" is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) +888
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access) +43
Project01.adduser.Signup_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\Project01\adduser.aspx.cs:80
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
خب این بار هم ASP .net ... وقتی می خواهید روی یک فایل چیزی رو بنویسید ایراد می گیره و حتی وقتی میرید و write بودن اون رو از توی IIS تنظیم می کنید باز هم Error می ده و بعد از اون وقتی می رید توی C:\Inetpub\wwwroot\[Project Name]\FileName و چک می کنید که ReadOnly نباشه می بینید که همه چیز درسته ولی بازم کار نمی کنه ... احتمالا اگر نسخه Serevr ویندوز رو کامپیوترتون نصبه برای حل این مشکل کافیه کارهای زیر رو بکنید.
- دوباره برید به آدرس C:\Inetpub\wwwroot\[Project Name]\FileName و روی فایل مورد نظر RightClick کنید و Properties و سپس Tab آخر یعنی Security را انتخاب کنید.
- احتمالا تا حالا 10 دفعه اینجا اومدید و دیدید که Administator که شما باشد write ش چک شده ولی شما باید از بین لیست "Group or user names" گزینة Users([your computer name]\Users) را انتخاب کرده و در جدول پایین Write رو انتخاب کنید به همین سادگی ....

Configuration Error

For below error you can go to IIS>WebSites>Default Web Site>[your project]>Right-Click>Properties and click on Create button (in Directory tab) and press Apply or Ok. I hope this helps.



Server Error in '/' Application.
Configuration Error
Description:
An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
Source Error:
Line 35: by Microsoft that offers a single logon and core profile services for member sites.
Line 36: -->
Line 37: <authentication mode="Windows" />
Line 38:
Line 39: <!-- AUTHORIZATION

خب این بار ASP .net
Microsoft Visual Studio .NET 2003 را اوردید بالا و یه برنامه ASP .Net Web Application درست کردید (گرچه دو تا هم پیغام داد) و فایل هاش ساخته و آماده شد. محض خنده همون اول کامپال (Ctrl+F5) می کنیم می بینیم این Error رو می ده. خب راست می گه، درد از IIS ه (یا ويژوال استدیو) که احتمالا به هر دلیل مسخره ای خودش نتونسته درست Config کنه. البته با Internet Information Services (IIS) Manager Version: 6.0 که رو این سیستم نصبه، تنها با کار کوچک زیر Error رفع شد.
1- IIS رو بالا بیاورید.
2- برید به Web Sites
3- برید به Default Web Site
4- برید به برنامه خود و روی اسم برنامه Right-Click کنید و properties را انتخاب کنید
5- Directory رو انتخاب کنید (همین طوریش هم انتخاب شده چون Tab اوله)
6- روی کلید Create کلیک کنید.
برای این مشکل همین کافی بود ولی تو ComboBox ی Execute Permission و چک باکس های بالاش می تونه Config ها و Permission های مختلفی تنظیم کنه.
مثلا اگه Database, XML یا هر فایلی دارید که از تو برنامه (WebSite) محتویاتش تغییر می کنه باید Write را علامت بزنید.

September 25, 2004

DirectX Beginner

If you work with any COM Object Function like as (DirectX functions, ...)
CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void **)&pSysDevEnum);
CreateClassEnumerator(CLSID_VideoCompressorCategory, &pEnumCat, 0);
and some thing like this ... and get Error (or problem)
you must use of this function After Start Application and Before Quite (Reached on WM_QUIT message) Application...
- CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); OR CoInitialize(NULL);
- CoUninitialize();


خب اگه با DirectX يا هر COM ديگه اي کار مي کرديد و بعد از يه ساعت کپي و پيست کردن از MSDN ;-) بازم کار نمي کنه ... بابا اين دوتا رو اول و آخر برنامت بنويس راه ميفته

- CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); OR CoInitialize(NULL);
- CoUninitialize();

حلله ... خوش باش ..